Over a futuremark someone asked how to clear a cstring.
Somone replied use strcpy()
another replied use memset()
i suggested *cString='\0';
what is the perfered method for clearing a cstring?
Over a futuremark someone asked how to clear a cstring.
Somone replied use strcpy()
another replied use memset()
i suggested *cString='\0';
what is the perfered method for clearing a cstring?
An empty string is represented by pointer to null character.
clear it to what. Spaces, or null characters?
one would beor if it is a pointer.Code:for(x=0;x<strlen(string);x++){ array[x]='\0'; }Code:pointerarray=NULL;
I think he means clear as in destroy, erase, incinerate or make-so-it's-lengt-wold-be-0.
EDIT: linuxdude, why wold anyone want to fill entire string with null characters?
>i suggested *cString='\0';
That would be my choice, unless of course the programmer is trying to destroy the data.