Consider the function call (calling int sum(int, int))
printf(\"%d\", sum(a,b));
How does the compiler decide that the
Existing answers say "because the C language spec says it's a list separator, and not an operator".
However, your question is asking "how does the compiler know...", and that's altogether different: It's really no different from how the compiler knows that the comma in printf("Hello, world\n"); isn't a comma operator: The compiler 'knows' because of the context where the comma appears - basically, what's gone before.
The C 'language' can be described in Backus-Naur Form (BNF) - essentially, a set of rules that the compiler's parser uses to scan your input file. The BNF for C will distinguish between these different possible occurences of commas in the language.
There are lots of good resources on how compilers work, and how to write one.