#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
int n;
int a,b,ans[10000];
char *c,*d,*e;
int i = 0;
c = (char*)(malloc(20 * sizeof(char)));
d = (char*)(malloc(20 * sizeof(char)));
scanf("%d",&n);
while(i < n){
scanf("%d",&a);
scanf("%d",&b);
itoa(a,c,10);
itoa(b,d,10);
a = atoi(strrev(c)) + atoi(strrev(d));
itoa(a,c,10);
e = c;
while(*e == '0')e++;
ans[i] = atoi(strrev(e));
i++;
}
i = 0;
while(i < n){
printf("%d\n",ans[i]);
i++;
}
}
最佳答案
您的程序中没有声明 strrev
这样的函数。编译器假定它是某个返回 int
的未知函数。因此,诊断消息是这样的,因为 atoi
需要一个指针,而不是 int
。
什么是strrev
?为什么你在不先声明的情况下尝试调用这个函数? C 标准库没有这样的函数,因此包含您已经包含的那些标准头文件是不够的(除非您假设一些扩展实现)。
关于c - 传递 'atoi' 的参数 1 使整数指针无需强制转换......任何人都可以帮助我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3027678/