Archived

This topic is now archived and is closed to further replies.

Structure Size Question

This topic is 5616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

While reading through the through one of the forums on the site I came across an article about pointers etc. The part that I am confused is as follows: /////////////////////////////////////////////////////////////// A pointer is an address variable. All pointers are four bytes wide. Pointers must have a type that describes the memory at the address they point to. int pointers point to int variables, and int variables only, for instance. They need to be of a certain type because pointers only point to a byte, which could be the only byte, or it could be the first byte or a longer data type. Here''s an example of one benefit of using pointers: struct RECORD { char szFirstName[80]; char szLastName[80]; char szAddress1[80]; char szAddress2[80]; char szPhone[20]; char szNotes[200]; } RECORD r; Here, r is a variable of type RECORD. The variable r requires 460 bytes of memory. ///////////////////////////////////////////////////////////// What I am confused about is that it says the variable r would need 460 bytes of memory. Should''nt the value be 540 bytes of memory? How about them apples?

Share this post


Link to post
Share on other sites
Probably missed an "80" when he punched it into the calculator

------------
aud.vze.com - The Audacious Engine <-- It''s not much, yet. But it''s mine... my own... my preciousssss...
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155

Share this post


Link to post
Share on other sites