Hello i am trying to make code which will request user for his phone number (on one line), that number will be stored in array number, everything works ok till i dont type less then 10 numbers and press enter, cycle is waiting for next number/s on new line but i want program to give message like: number is too short or too long , type that number again: i have tried many options with while cycle and do while but none of them works properly
Code:
#define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
int main()
{
int number[10];
printf("type your number: \n");
for (int i = 0; i < ARRAYSIZE(number); i++)
{
scanf("%1d",&number[i]); //fe input: 033232313 is correct
//123 is incorrect user will be able to type numbers again
}
...
}
Thanks in advance for any help...