I need help as I am completely stuck here. Any idea for crictism will be very helpful.
I have string say ” cat-dog-animal”
and i want string like “dog-cat-animal”
I am slightly struck. I know in C i can use strtok , but that will break the string.
I AM wondering how to store that string in above format.
Thanks
Treat the first 2/3 of the string as a ring buffer and rotate the characters in it.
Granted it is not the most efficient solution, but it does work.
I’d post some actual code, but this sounds like homework.
Edit
If your string library doesn’t have strrchr() or memmove() they can be easily replaced by loops.