string - Passing a struct array into a function and performing sizeof operation upon it -


i suppose standard arrays (i.e integer arrays), when pass array of structs must pass size of array it. not yet understand when take sizeof structure first element 4 (meaning 4 bytes in first element?).

now pass array of structs contains strings. inspect size of single array element (remember 1 struct) 28, after i've passed function (and yes passed function mean passed value address of first element in array), 4.

now i'm guessing sizeof getting first element of struct in array. have array myarray of type mystruct:

mystruct { string name string address string postcode }

i presume sizeof looking @ "name"? know fact name isn't 4 bytes long - it's 10.

what sizeof looking at? memory structure of array of structs?

thanks thomas

the 4 size of pointer have passed rather size of struct refers.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -