numbers appears 1245052

i'm using VC++6 to compile c files
i have a prolem when i write this
#include<iostream>
void main()
{
int i=100;
printf("%d",&i);
}
on running the program it appears 1245052 instead of 100
asn this number appears regardless any number i equals

&i gets a pointer to the variable i. What you're doing is printing the address in memory at which i is stored.

If you want to print the contents of i, just do printf("%d",i);
thank u very much
Topic archived. No new replies allowed.