```
int* plusOne(int* a, int n, int* n2)
{
int i,j,k=1;
int*a2=(int*)malloc(sizeof(int)*(n+1));
for(i=n-1;i>=0;i--)
{
j=(a[i]+k)%10;
a2[i+1]=j;
k=(a[i]+k)/10;
}
if(a2[1]==0)
{ *n2=n+1;
a2[0]=1;
return a2;
}
else
{
*n2=n;
return a2+1;
}
}
```