Can anybody tell me how to implement a program to check a string contains all unique chars ?
Without using additional memory:
#define UNIQUE_ARRAY 1
int isUniqueArray(char* string){
if(NULL == string ) return ! UNIQUE_ARRAY;
char* current = string;
while(*current){
char* next = current+1;
while(*next){
if(*next == *current){
return ! UNIQUE_ARRAY;
}
next++;
}
current++;
}
return UNIQUE_ARRAY;
}