So I declared a variable as an integer and initialized it to 0. When I tried printing the value of that variable, it gave me an incredibly high number. int
x=0; printf("%d", &x);
This is what I did. Am I doing anything wrong? Thanks in advance.
Oh okay. I completely forgot about that. Thanks :)
2
You print the address of the x so it will print the address during the compile time it will display the warning warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat] So use following printf("%d",x);