Why is it that when I use a space before the format specifier in scanf()
the program works fine. Code below:
printf("What's your username: ");
scanf(" %s", username);
printf("Do you want to make a deposit or a withdrawal? [d/w]\n");
scanf(" %c", &choice);
When I don't have a space like this code below, it exits:
printf("What's your username: ");
scanf("%s", username);
printf("Do you want to make a deposit or a withdrawal? [d/w]\n");
scanf("%c", &choice);
Is there a good explanation to this?