passing argument 1 of 'atoi' makes pointer from integer without a cast....can any body help me..
Posted
by somasekhar
on Stack Overflow
See other posts from Stack Overflow
or by somasekhar
Published on 2010-06-12T05:55:29Z
Indexed on
2010/06/12
6:02 UTC
Read the original article
Hit count: 256
#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++;
}
}
© Stack Overflow or respective owner