Searching for "printf()"

Q:

If I use the following printf() to print a long int why I am not warned about the type mismatch?

printf ("%d",num );

Answer

When a function accepts a variable number of arguments , its prototype cannot provide any information about the number of arguments and type of those variable arguments. Hence the compiler cannot warn about the mismatches. The programmer must make sure that arguments match or must manually insert explicit typecast.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming