I am trying to reverse a string in c but i get segmentation fault, core dumped error, couldn figure out the error.
#include<stdio.h>
#include<string.h>
void main(){
char inputstr[100];
int i = 0;
char revstr[100];
printf("Give me something to reverse!!:\t");
gets(inputstr);
printf("You entered %s\n", inputstr);
int lenstr = strlen(inputstr) - 1;
while(lenstr >= i){
strcpy(revstr, inputstr[lenstr]);
lenstr = lenstr -1;
}
printf("%s\n", revstr);
}