|
-
November 20th, 2003, 05:58 AM
#2
Because 1 is the smallest dimension for the array that allocates space for it. The way these things work is that the struct is declared with an array of size 1 (as the last member). When the memory for the struct is allocated it can be bigger than the structs declared size allowing access to further array elements.
eg. MYDATA *p = malloc(sizeof(MYDATA) + 100;
now the array indexes could range from 0 to 100.
The Length field is used to convey the number of elements that are accesible in the array.
Dave Mclelland.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|