hi, i wanted to know if there is any way to read character`s from string one by one, and set it in other string. i mean i have this string: char *get = "hello"; now i want to get over the string char by char and if the letter != 'l' copy it to other string, like : Code: char *copy; char c; int i; for (i=0;get[i] != '\0';i++) c = get[i]; if (c != 'l') { copy[j] = get[i]; j++; } i dont want to do it by strchr,strtok... i want do it by reading char by char from the string, (the all problem when i tring to add the char to the copy array it tells me : canot covert char to char * any idea? Thanks, Or.
In the above snippet *copy is a pointer to a character that you have never initialized. You will need to initialize this variable before you can use it. You will need to insure that it large enough to hold the results of your copy. Jim