I am checking a student's homework. The assignment is to print the amount of English letters to the console. For some reason, what he did works (7th line):
int main(void)
{
char first = 'A';
char last = 'Z';
int amount = 0;
amount = ("%d - %d", last - first + 1);
printf("The amount of letters in the English alphabet is %d\n", amount);
return(0);
}
After seeing it, I tried putting other things in the brackets instead of "%d - %d". No matter what I put there and how many commas were there, it'd only take what's after the last comma (which is the correct sentence).
What is actually happening there?