Hi there,
I was writing a program to read in a string and print it out in reverse. But for some reason it doesnt compile.The error said
In function ‘main’:
error; too few arguments to function ‘tnirp’
Code:
#include<stdio.h>
#include<string.h>
void tnirp(char s[],int max);
int main(int argc, char * argv[]){
char s[100];
printf("Enter string\n");
fgets(s,100,stdin);
tnirp(s);
return 0;
}
void tnirp(char s[],int max){
int i,j;
char rstr[100];
for(i=strlen(s)-1,j=0; i>=0; i--, j++){
rstr[j]=s[i];
}
rstr[j]='\0';
printf("%s",rstr);
printf("\n");
}
I dont know wats going wrong.
Thanks in advance every1