2 test cases not correct

My 2 test cases are not correct and i dont know what those are. I have tried various test cases to try and break my program but it always gives the right answer. Is there any way of finding out the which test case to apply? also what test case should I test this program against.
the program :

#include
#include
using namespace std;

int main()
{
int i, j, n, m, a[1000], b[1000], c[1000];
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a[i];
}
cin >> m;
for (i = 0; i < m; i++)
{
cin >> b[i];
}
int maximum = max(n, m);
int k = maximum;
int carry = 0;
for (i = n - 1, j = m - 1; i >= 0 && j >= 0; i–, j–)
{

    c[k] = a[i] + b[j] + carry;
    if (c[k] >= 10)
    {
        c[k] = c[k] % 10;
        carry = 1;
    }
    else
    {
        carry = 0;
    }
    k--;
}
while (i >= 0)
{
    c[k] = a[i--] + carry;
    if (c[k] >= 10)
    {
        c[k] = c[k] % 10;
        carry = 1;
    }
    else
    {
        carry = 0;
    }
    k--;
}
while (j >= 0)
{
    c[k] = b[j--] + carry;
    if (c[k] >= 10)
    {
        c[k] = c[k] % 10;
        carry = 1;
    }
    else
    {
        carry = 0;
    }
    k--;
}
if (carry == 1)
{
    c[k] = 1;
}
if (c[0] == 0)
{
    for (i = k + 1; i < maximum + 1; i++)
    {

        cout << c[i] << ", ";
    }
}
else
{
    for (i = k; i < maximum + 1; i++)
    {

        cout << c[i] << ", ";
    }
}

cout << "END";

return 0;

}

your code fail for this input
3
9 9 9
3
9 9 9
Your output
9, 9, 8, END
Correct Output
1, 9, 9, 8, END

this is because size of final ans array ( c ) may be larger than max(n,m) or may not

correct approach is
add two arrays from end but store ans in c array from starting
and at end print the array in reverse order

Reference Code

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.