+ 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

21st Feb 2022, 10:20 AM
Lakshay Kamat
Lakshay Kamat - avatar
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
21st Feb 2022, 11:09 AM
Shadow
Shadow - avatar
+ 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.
21st Feb 2022, 10:27 AM
HungryTradie
HungryTradie - avatar
+ 2
HungryTradie Sorry for inconvenience
21st Feb 2022, 3:34 PM
Lakshay Kamat
Lakshay Kamat - avatar
0
Are you sure it works in VSCode? if it does, then VSCode is dumb.
21st Feb 2022, 11:09 AM
Ipang