+ 5
What is the exact algorithm for strrev () function in c ?
In c we have a function that reverse a string which is strrev () what is the exact algorithm which is used to reverse a string in c language.
3 ответов
+ 8
I dont really know the exact algorithm that the strrev function uses to reverse a string, but as we know a string in C is an array of char so if you want to reverse it you can go through it with a for loop, create a new array with same size of original one and assign every index in new array with the opposite index of old array!
here is an example of how it can be done:
https://code.sololearn.com/c0QeNsH0r0tP/?ref=app
+ 2
Thank you