+ 1
I want to show reverse of string but shows error everytime. This code is working on Vs code but here shows error
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(){ char string1[50]; int i = 0; printf("Enter your Name = "); scanf("%s",&string1[50]); printf("Length of %s is %ld\n\n",string1,strlen(string1)); printf("ASCII Value of %s \n",string1); while (string1[i]!='\0') { printf("%d ",string1[i]); i++; } printf("\n\n"); printf("Reverse of Your Name is %s\n",strrev(string1)); return 0; } https://code.sololearn.com/ciW89mWgT524/?ref=app
4 Answers
+ 4
The strrev() function is not available on SoloLearn as noted by HungryTradie due to it not being a standard function and therefore optional.
See:
https://www.sololearn.com/discuss/2100807/?ref=app
https://www.sololearn.com/discuss/2873649/?ref=app
https://www.sololearn.com/discuss/2377771/?ref=app
+ 2
G'day Lakshay kamat it is much easier for others to run your code when you create and link a SoloLearn "code bit".
scanf("%s",&string1[0]);
Not sure why, but strrev() isn't supported on SoloLearn.
+ 2
HungryTradie Sorry for inconvenience
0
Are you sure it works in VSCode? if it does, then VSCode is dumb.