printf giving me incorrect output in C

前端 未结 5 1964
长情又很酷
长情又很酷 2021-01-21 09:44

This is probably a very elementary problem, but I cannot find the answer anywhere, and this is the first time I\'ve had the problem after several weeks of programming in C. In e

5条回答
  •  不思量自难忘°
    2021-01-21 10:13

    You have to do:

    printf("size is %d", size);
    

    instead. This prints the value of the int object size.

    But

     printf("size is %d", &size);
    

    is undefined behavior.

提交回复
热议问题