大整数加法的问题,试了很多组数据都没有问题,结果oj不通过

#include<stdio.h>
#include<string.h>
int main(){
char a[10000];
char f[10000];
int b[100000]={0};
int q[100000]={0};
int p[100000]={0};
int c,d,e,g,h,i;
scanf("%s",&a);
d=strlen(a);
scanf("%s",&f);
e=strlen(f);
for(c=0;c<d;c++){
b[c]=a[c]-'0';
}
for(c=0;c<e;c++){
q[c]=f[c]-'0';
}if(d>=e)h=d;else h=e;
i=h;
for(g=0;h>1;h--,d--,e--){
if(d!=0&&e!=0)
g=b[d-1]+q[e-1]+g;
else if(d!=0)
g=b[d-1]+g;
else if(e!=0)
g=q[e-1]+g;
if(g<10)p[h-1]=g;
if(g>=10)p[h-1]=g%10;
g=g/10;
}if(d==1&&e==1)
p[0]=b[0]+q[0]+g;
else if(d!=1)
p[0]=q[0]+g;
else if(e!=1)
p[0]=b[0]+g;
c=0;
if(p[0]==0){
for(c=0;p[c]==0;c++){if(c==i-1){printf("0");return 0;}}
}
for(;c<i;c++){
printf("%d",p[c]);
}
return 0;
}

你这处理不了负数