Here is my code:
void
do_print(int varnum, int *var) {
printf("register %c: ", varnum+CH\_A);
int i = 0;
while(*var>0){
v[i] = *var%10;
*var/= 10;
i++;
}
I am trying to store each digits of a number into an array, but when I tried very large number such as 12478783917289471284, the answer is incorrect. I know to convert it into a string, but when I changed the type int var to char var, the previous code which uses this function generates an error. The previous code is:
if (optype == PRINT) {
do_print(varnum, vars+varnum);
Is there a way to change vars+varnum back to int?
How can I store very large number into a string in C?
Thank you!