Hello i am having an error when i try to compile my code.
int main()
{
char string_buffer[20], string_buffer1[20];//which is going to be copied into and reversed.
printf("Enter the string to check if it is a palindrome\n");
scanf("%20s", string_buffer);
strcpy(string_buffer1,string_buffer);//copying string_buffer into string_buffer1
strrev(string_buffer1);//reverse string_buffer1
if (strcmp(string_buffer,string_buffer1) == 0){//check to see if they are the same
printf("Palindrome.\n");
}else{
printf("Not a palindrome.\n");
}
return 0;
}
When i try to compile i get this warning and error.
palindrome.c:12:2: warning: implicit declaration of function 'strrev' is invalid
in C99 [-Wimplicit-function-declaration]
strrev(string_buffer1);//reverse string_buffer1
^
1 warning generated.
/tmp/palindrome-1efe10.o: In function `main':
palindrome.c:(.text+0x68): undefined reference to `strrev'
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)