I'm trying to scan a line. This line will sometimes contain 1 char. or sometimes it will contain 1 char followed by a string.

printf("\nEnter text now");
scanf("%c", &char1);
scanf("%s", %string1);

this works if i enter both values such as 'c filename' but if i enter just 'c' it crashes.

i don't really understand how i would go about checking if both are entered or not.