“printf” only printing variable addresses

后端 未结 2 1869
青春惊慌失措
青春惊慌失措 2021-01-27 03:45

so here is my code:

#include 
main(){
int hi;
hi = 3;
printf(\"%d\",&hi);
}

and the output is: \"2686748\"

im using

2条回答
  •  走了就别回头了
    2021-01-27 04:01

    The "%d" tells the printf you are putting in an integer. The integer you are giving it is &hi which is the address of hi. If you want the value of hi just use that

提交回复
热议问题