+ 10
Why this code can't be used as a replace of strrev function
I know strrev function will not work in sololearn. So I made a replace function for it but it is not giving the answer can any one correct the mistake. Here is my try. https://code.sololearn.com/cB5mRRQNpgS1/?ref=app
9 Respostas
+ 3
https://code.sololearn.com/cAksCt6hQbO4/?ref=app
+ 7
Thanks Djivs for your help
+ 6
Nice idea Djivs . But why should we set size for a pointer to use it. Can't we use directly
+ 5
Sorry I didn't understand what you are saying Djivs can you change it in my code and keep the correct code
+ 2
It seems like you didnt set char *c size, but not what I said before
+ 2
Sadly, no, because in C we have to allocate memory first.
We need to work with memory very carefully :)
+ 2
You are welcome :)
+ 2
Puthur Harthik, that's because you declared a new variable of type pointer to a char but you haven't initialized it, which means you try to access an undefined memory location.
+ 1
You need to do reverse cycle only for i <= k/2
Example:
abcd 0
dbca 1
dcba 2 - already reversed
dbca 3
abcd 4