So I have a void function called phone where I want to ask the user to input a 11 digit number starting with 0 where it's possible to have a single gap (eg. 01234567890 or 01234567 890).
void phone()
{
char number[20];
printf("Please enter your phone number: ");
fgets(number, 20, stdin);
while(number[0] != 0 && (strlen(number) != 11 || strlen(number) != 11 + ' '))
{
printf("please try again");
fgets(number, 20, stdin);
}
}
This is my current function that I have where I can make it work to accept numbers starting with 0 I can't get the second either or part of the condition to work. I'm relatively new to c so I'm not really sure if there is an easier way to do this. Also if you look at my output it jumps from the first print statement to the second before asking for input, not sure where the fault is there as I have fgets before the while function. output