DelphiFAQ Home Search:

How to declare and initialize static arrays


commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

The following piece of Object Pascal shows how to declare and initialize static arrays:

   sArray1 : array [1..3] of string =
      'item #1',
      'item #2',
      'item #3'
// For an array of records, it looks a little messy:
   sArray2 : array [1..3] of record a : integer; b : string end =
	 (a: 100; b: 'Word 1'),
	 (a: 200; b: 'Word 2'),
	 (a: 300; b: 'Word 3')

Content-type: text/html


2006-04-21, 00:33:20
anonymous from Pakistan  
differant between static and dynamic arrays
2006-09-22, 16:50:56
anonymous from United Kingdom  
This was very useful - thanks! - Paul.
2009-05-07, 06:03:37
anonymous from Brazil  
Hi... Nice topic, but, how i initialize a trecord's type?

leo from brazil



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: