```
int* plusOne(int* digits, int digitsSize, int* returnSize) {
int carry = 1, i = digitsSize;
int* ret = (int*)malloc(sizeof(int)*(digitsSize+1));
while (i > 0) {
ret[i] = (digits[i-1]+carry)%10;
carry = (digits[i-1]+carry)/10;
i--;
}
if (!ret[1]) {
// size increased 1, set the first digit
ret[0] = 1;
*returnSize = digitsSize+1;
return ret;
} else {
*returnSize = digitsSize;
return ret+1;
}
```