printf displays something weird

后端 未结 5 1326
刺人心
刺人心 2020-12-06 19:26

There is such code:

#include 

int main() {
  float d = 1.0;
  int i = 2;
  printf(\"%d %d\", d, i);
  getchar();
  return 0;
}
5条回答
  •  Happy的楠姐
    2020-12-06 19:32

    A float is stored in memory in a special format, it's not just a number and some decimal places see How to represent FLOAT number in memory in C

提交回复
热议问题