From: "Mike Walters" <[EMAIL PROTECTED]>

> First of all, in your declarations, you have only declared three
*pointers*
> to chars, not three strings.  No memory has been allocated for the strings
> yet.  So you must either declare the strings as:
>
> char sdf[10], ghj[10], klm[10];
>
> or must use alloc or malloc to allocate memory for the strings.

Actually, that part of the code is valid:

 char *sdf;
 sdf = "ABC";

Four bytes of constant data have been allocated for "ABC", and sdf is set to
point at that data. If sdf isn't going to change, then

 char sdf[] = "ABC";

is equivalent, and saves the space for the pointer.

(This ignores const issues--I'm just talking about memory allocation.)


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to