楼主为什么要这么用呢? [解决办法] "%f" 输出浮点数是 8 个字节的吧, 一个整数只有 4 个字节, printf 函数去读后面的 4 个字节的时候访问就越界了. [解决办法] 我运行出R6002错误 MSDN上有:A format string for a printf or scanf function contained a floating-point format specification and the program did not contain any floating-point values or variables. 所以把代码改一下:
C/C++ code
#include <stdio.h>int main(void){ int a=5; float b = a; printf("%f",a); return 0;} [解决办法] 我运行出R6002错误 MSDN上有:A format string for a printf or scanf function contained a floating-point format specification and the program did not contain any floating-point values or variables. 所以把代码改一下:
C/C++ code
#include <stdio.h>int main(void){ int a=5; float b = a; printf("%f",a); return 0;} [解决办法] float 不是4个字节吗? %lf double才是8个。