deleting string...
example:
deleting...
enter string: the quick brown fox and the lazy dog.
enter string to delete: the(the first one)
new string: quick brown fox and the lazy dog.
deleting string...
example:
deleting...
enter string: the quick brown fox and the lazy dog.
enter string to delete: the(the first one)
new string: quick brown fox and the lazy dog.
And????
pls. help me in how to program that...
pls. help me in how to program that...
char str[]="the quick brown fox and the lazy dog" ;
int i =0;
while(str[i] !=' ' )
i++;
strcpy(str,str+i+1);
works if the above is your requirement, analyze it yourself.
happy learning...........
Did you forget to read Announcement: We only give homework help to those who show effort? Or maybe Read Me: Read This Before Posting? Or even the all important Member Rules?
char str[]="the quick brown fox and the lazy dog" ; int i =0; while(str[i] !=' ' ) i++; strcpy(str,str+i+1);
works if the above is your requirement, analyze it yourself.
happy learning...........
Spot the undefined behavior in the above code. Happy learning! ;)
Spot the undefined behavior in the above code. Happy learning! ;)
i dint see any undefined behaviour statements in the code.
can you please spot it.
strcpy(str,str+i+1);
The strcpy function copies the string pointed to by s2 (including the terminating null character) into the array pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.