#include <stdio.h>
#define MAX_NUMS 5 // change me to 1000
int main(int argc, const char * argv[])
{
char numberString[ MAX_NUMS + 1 ];
int numberNumeric [ MAX_NUMS ];
printf("Enter number ");
scanf("%s",numberString);
for ( int i=0; i < MAX_NUMS; ++i)
{
printf("converting %c\n",numberString[i]);
numberNumeric[i] = (numberString[i] - 0x30); // convert ascii to integer
}
// Your array of 1-digit numbers
for ( int i=0; i < MAX_NUMS; ++i)
{
printf("%i ",numberNumeric[i]);
}
return 0;
}
solved C Programming: How do I insert a number into an array such that each digit of the number goes into each field of the array? [closed]