Skip to main content
GameDev.net gamedev.net
🔒 Locked

Structure Size Question

Started by popcorn Jul 28, 2002 at 4:45 PM 2 replies 400+ views
Original Post
popcorn
popcorn
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?
How about them apples?
LockePick
LockePick
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
Like2Byte
Like2Byte
quote:
Original post by LockePick
Probably missed an "80" when he punched it into the calculator



Concur.
Advice, eh? Well, besides working on your swing...you know, besides that...I'd have to think.
Zipster
Zipster
Or he forgot an "//" in front of one of the 80 byte array declarations in the posted code

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.