#define MAXLEN 6000 char * addStrings(char * num1, char * num2){ char* arr=(char*)calloc(MAXLEN+1,sizeof(char)); int right1=strlen(num1)-1, right2=strlen(num2)-1, flag=0, i, pst=MAXLEN, temp1, temp2; while(right1>=0 || right2>=0 || flag){ temp1=(right1>=0)?num1[right1--] :'0'; temp2=(right2>=0)?num2[right2--] :'0'; arr[--pst]='0'+(temp1-'0'+temp2-'0'+flag)%10; flag=(temp1-'0'+temp2-'0'+flag >= 10)?1 :0; } return arr+pst; }