Mail Archives: djgpp/1996/06/12/00:10:07
Reply to message 8767006 from CALVID AT CORTEZ on 06/10/96 12:26PM
This is just basic C. Go read any textbook.
>big zero; <-- this will be 40K bytes
>big *one; <-- this will be 4 bytes
>big *two; <-- so will this
>big *three; <-- and this
Pointers NEVER create their own space, unless you use malloc(). That's
the whole point. If you modify *one, you'd be modifying zero, *two, and
*three,
assuming that one, two, and three all pointed to zero.
Since you sound like a beginner, I'll give you another tip. ALWAYS
initialize your pointers before using them. For example, this is okay:
int foo[100];
foo[0] = 10;
But this is not:
int *foo;
foo[0] = 10;
The reason is that when you declare it, foo is completely undefined
until you initialize it with a value. If you try the latter example, you will
be lucky if your program only crashes.
John
- Raw text -