Magix wrote on 02/08/04 :
How do I set the char [ ] to empty ?
let say I have,
char test[20];
can I do like this :
*test = NULL;
Where did you get that? Certainely not from a good C-book. 'test' being
an array, it's a constant pointer. It can't be modified.
What do you mean by 'empty'? An object has always a value. It is never
'empty'.
That said, a peculiar value could have the semantics of 'empty'. Its a
matter of convention. If you are talking about a string, it's
considered 'empty' or "" when you have a 0 at index 0.
char test[20];
test[0] = 0;
or
*test = 0;
or
strcpy (test, "");
because "" is hard coded
char anonymous[] = {0};