|
-
January 24th, 2011, 07:08 AM
#1
handle character at string(c)
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|