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
Post a Comment