Tuesday, 1 October 2013

Strings in C Issues

Strings in C Issues

I'm wondering what the difference is between
char* str[NUM];
char str[NUM];
char* str;
My understanding is that an array definition such as the one in the middle
points to the address of the first value, that is str[0]. But I also see
the notation represented by the first line of code, that is, a pointer to
an array. Are these three equivalent? I'm aware the array definition sets
space in the stack for NUM characters so is that probably better than just
char* str?
Thanks

No comments:

Post a Comment