Few testcases fails

#include<bits/stdc++.h>
using namespace std;
void calsumtil(int a[],int b[],int n,int m){
int s=0;
int c=0;
int sum[n];
int i=n-1;
int j=m-1;
int k=n-1;
while(j>=0){
s=a[i]+b[j]+c;
sum[k]=s%10;
c=s/10;
i–;
j–;
k–;
}
while(i>=0){
s=a[i]+c;
sum[i]=s%10;
c=s/10;
i–;
k–;
}

if(c){
	sum[0]=10;
}

for(int i=0;i<n;i++){
cout<<sum[i]<<", ";
}
cout<<“END”;
}

void calsum(int a[100],int b[100],int n,int m){
if(n>=m){
calsumtil(a,b,n,m);
}
else{
calsumtil(b,a,m,n);
}
}
int main() {
int n;
cin>>n;
int a[100];
for(int i=0;i<n;i++){
cin>>a[i];
}
int m;
cin>>m;
int b[100];
for(int i=0;i<m;i++){
cin>>b[i];
}
calsum(a,b,n,m);
return 0;
}

The size allocation has to be dynamic. Also you need to handle the cases when n>m or m>n differently. See this https://ide.codingblocks.com/s/425001

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.