problem with printf function?

前端 未结 5 1819
Happy的楠姐
Happy的楠姐 2020-12-20 03:28

i wrote the following program

 #include 

 main()
 {
 int i = 2;
 float c = 4.5;
 printf(\"%d\\n\",c);
 printf(\"%f\\n\",i);
 return 0;
 }
         


        
5条回答
  •  时光说笑
    2020-12-20 04:28

    Using incorrect format descriptors results in an Undefined Behavior.
    Undefined Behavior means the behavior cannot be explained. It might work it might not or give unpredictable results, this behavior can vary anyhow, it cannot be explained in portable conclusive way for all compilers.

提交回复
热议问题