11: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[100]’
这是我的错误....广东话修复它...错误的格式
#include <stdio.h>
#include <string.h>
int main()
{
char *a;
char *count;
char str[100];
int i ;
printf("\n:enter string for Palindrome test\t");
scanf("%s", &str);
i= strlen(str);
//a=(char *)malloc(i*sizeof(char));
a=&str[0];
count=&str[i-1];
while((*(a++)==*(count--)) && i>=1)
{ i--; }
if(i==0) { printf("\n%s is a palin",str);}
else { printf("\n%s is not palin",str);}
}
为什么我的代码不运行? –
它运行良好。看到它[这里](http://ideone.com/ZxZQEE)。只需在关闭'}'的'main'之前添加'return 0;'。 – haccks
不要相信你可以声明一个单一的符号作为回文... – Runium