Broken Calculator

Can you help me with the code here.
I am maintaining an array to save individual digits of the factorial.

I’ve made some changes.
But I am getting run error in one test case. Please help.

Change line number 45 to int result[1000000] = {0};
Large factorials cannot be stored in length of 500.

Thanks.
Doubt cleared.