I am trying to reverse a string. But when I compiled my code using gcc filename
it reports the following error:
gcc itoa.c itoa.c: In function ‘main’: itoa.c:9:21: warning: implicit declaration of function ‘strrev’ [-Wimplicit-function-declaration] printf("S=%s \t \n",strrev(s)); ^
itoa.c:9:8: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] printf("S=%s \t \n",strrev(s)); ^
/tmp/ccK1YuDL.o: In function
main': itoa.c:(.text+0x38): undefined reference to
strrev' collect2: error: ld returned 1 exit status
My src code is :
#include<stdio.h>
#include <string.h>
int main() {
char s[10]="ZAkir";
printf("S=%s \t \n",strrev(s));
return 0;
}