Is there a way I can store a double digit integer in a single array slot? Also, I know my code is completely wrong I just need help understanding a method to perform the task.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char input[4];
do {
printf("Enter a value greater than 9: ");
scanf("%s", input);
} while (isalpha(input[0]));
int numValue = input[0] - '0';
printf("%d\n", numValue);
system("PAUSE");
return 0;
}
Also, I know input[0] will just check and output the first digit of the users input. I tried numValue = input - '0';, and I believe it outputted the address of input - 48. Moreover, I tried while (isalpha(input));, and I got a Run-Time error.