christy wrote:
Thank you Matt.

If you don't mind I ask, what does this statement do?
  short_str[j] = 0;
it's the same as:
short_str[j] = '\0';
0 and '\0' are essentially the same because '\0' means a single null-zero character which is a byte of value 0x00.

Also, would the following initialize short_str to an
empty string?

Char * short_str;
short_str[0] = '\0';
no, because it does not allocate memory and assign the pointer. if you want a string, you need to allocate memory, the easiest way is this:
char short_str[20] = { 0 };
which allocates 20 bytes of space and sets each item in the array to 0. keep in mind that you have to account for the null zero so that array would only hold a 19 character string. If you need more space just increase 20 to whatever size you need.


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

Reply via email to