problem with printf function?

前端 未结 5 1866
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:26

    Basically, the format placeholder is an instruction to the function about how to retrieve and interpret the next chunk of memory from the variable length argument list. It expects the format to be exactly what you tell it. When you retrieve memory in unintended ways, you can cause all sorts of issues and undefined behavior. This is why printf and its ilk are exploitable.

提交回复
热议问题