Wrong number of parameters to printf leads to strange results

后端 未结 4 1716
臣服心动
臣服心动 2021-01-27 01:26
#include 

int main() {
   int i=10,j=20;
   printf(\"%d%d%d\",i,j);
   printf(\"%d\",i,j); 
   return 0;
}

Using the Turbo C compiler,

4条回答
  •  礼貌的吻别
    2021-01-27 01:44

    The first call to printf() has one too many format specifiers, resulting in undefined behaviour. In this case a garbage value is printed.

提交回复
热议问题