Please give me a peice of code which will reverse the string with out using temporary string.
Given string: "Car is black in colour"
output: "colour in black is Car"
Please help me by giving the code preferably in C.
Thanks in advance,
murali
Please give me a peice of code which will reverse the string with out using temporary string.
Given string: "Car is black in colour"
output: "colour in black is Car"
Please help me by giving the code preferably in C.
Thanks in advance,
murali
So you want to reverse the words not the string? Why don't you write it with a temporary string and then figure out hwo you can remove it instead of us dong all the work?
That's not gonna happen. Sorry, but this reeks of homework and if we gave you the code then you wouldn't learn anything. But here's a hint: Reverse each word, then reverse the whole string. You can do an in-place reversal by swapping characters from the outside in.Please help me by giving the code preferably in C.
Just because I don't care doesn't mean I don't understand.
sniff....sniff....i smell homework.
Getting back to your question, you should learn that a string is represented as a char array...now about reversing the string, i understand bout not using the temp string...u can just allocate some memory using malloc and then free it.I leave it up to u to think how to actually reverse the string.Dont expect to get code written from someone over here..programming is all about doing IT on your own.
Code:>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.
Sorry we won't be doing your homework for you.