0
Why the strrev[i] = '\0' null in the end of the code?
https://code.sololearn.com/csJ1sY4LSGI4/?ref=app Code is from https://www.tutorialgateway.org/c-program-to-reverse-a-string/ Not my own code, but all many thanks to them from tutorials.
4 Answers
+ 4
Anmol Kumar I'm don't know much about C but I'm not sure...
If I comment out that line i get the same output.
Veli-Matti strrev is a function. Use another variable name to avoid error in other compilers.
https://www.sololearn.com/discuss/2149972/?ref=app
+ 1
Well, strlen function doesn't include null character ('\0') while counting the characters in your string, so we've to explicitly tell the compiler about the null character by doing strrev[i] = '\0'
0
Thank you very much!
0
Strrev didnt work in sololearn last time I tried.
Some say its not a standard function.
But Ty for the tip!