cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
numbers appears 1245052
numbers appears 1245052
Feb 28, 2009 at 3:27pm UTC
mos6afa
(4)
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
Feb 28, 2009 at 3:30pm UTC
Disch
(13742)
&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);
Feb 28, 2009 at 3:35pm UTC
mos6afa
(4)
thank u very much
Topic archived. No new replies allowed.