printf
signature is
int printf ( const char * format, ... );
The first parameter is the format string and all the following parameters are the format specifiers (subsequences beginning with %).
printf("%d \n","%d",a,b);
The code above invokes undefined behaviour because the first format specifier %d
is used to present decimal integer value while the parameter matching this specifier is "%d
" which has type const char *
.
You should change it to:
printf("%d %d\n",a,b);