0
Weird behavior
Why there is no output in this code?!! https://code.sololearn.com/c9U7913B7lPB/?ref=app
3 Answers
0
Mostafa Ehab SL system dont handle really good errors by compilers
+ 1
Because it raise a compile time error when you call strrev on snum. The problem is than snum is a pointer to a literal string which compiler store in a constant (eg. not writable area). Because strrev reverse an ASCII string in place, it have to edit (eg. write) the data pointing to snum then, for what i said before, an error happen.
One solution is declare snum like an array than is stored onto stack then it can be writable:
char snum[] = "anystring";
Anyway, i never seen this function and doing some search on google, it seem to be a not-standard function avaible only on Windows environment.
+ 1
KrOW thanks man it workedđ, by the way the strrev require string.h but i have another question why it doesnât give me an error message instead of no output?!