Quantcast
Channel: User Alex Lop. - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by Alex Lop. for static variable changing value with no error displayed?

$
0
0

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);

Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>