That didn't work.
This is so confusing. I didn't think it would be this tough. So, I am only allowed to use the <stdio.h> library and I can't use getchar or putchar. I know the input will be a string of characters. However, like laserlight mentioned, those characters need to be converted to integers.
ie.) Input is 1293942
Output:
1
2
9
3
...
The reason why they can't be left as character strings is because I will need it to be integers so I can do some algorithms with them for the other part of my program. I just need a way to separate the individual numbers from the input.
Here's where im stuck (SIZE is defined to be 5):
Code:
printf("Input: ");
for (i=0; i<SIZE; i++)
{
scanf("%d", &number[i]);
}
printf("Result: \n");
for (i=0;i<SIZE; i++)
{
printf("%d", number[i]);
printf("\n");
}
I understand the numbers being scanned are not characters. When I scan them using %s, I get a segmentation fault.