If you have strings consisting of many words like
"abc def xyz"
use strtok functions (space as a delimeter)
to get the words.
limitation:if multiple spaces occur like abc def xyz "
it wont work perfectly.
1)read the string charecter wise (one char at a time) until you find a space.
here is your word.
2)Increase the poiner until u get and alphabet again for going to the beginning of the next word. then again step:1.
Well, if you first skip all non-alphabetic characters, using a loop, then the loop will stop when the first letter of the word is encountered.
And then he'll have to run another loop, to get to the end of the word.
I guess you wanted to write this: for (i = 0; *(ptr+i) [B][COLOR="Green"]!=[/COLOR][/B] '\0'; i++)[COLOR="Green"][B];[/B][/COLOR] (also note the semicolon at the end)
And this won't work either if you want to place a '-' at the end of the name: *ptr = '-';.
I guess you wanted to write: *(ptr+i) = '-'; here.
And you'll also want to add this line: *(ptr+i+1) = '\0';right after it (because you overwrite the null-terminator with the previous line).
And you'll also want to change this: printf("\n\n%s", ptr[i]);
to this: printf("\n\n%s", ptr);
or better, to this: printf("\n\n%s", name);
Remark: make sure that the string which will hold the name is big enough, maybe change its size to 20?
Why do you use a separate variable? If you could just increment the pointer?
Also: please post your code using code tags the next time
Edit:: I assumed that you wanted to place a '-' at the end of the string.
Edit:: Please mention the next time also what your code has to do as it will make life easier for both: you and me.
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...