Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!mailrus!cornell!uw-beaver!zephyr.ens.tek.com!tekigm2!richardp From: richardp@tekigm2.MEN.TEK.COM (Richard R Prince) Newsgroups: comp.lang.c Subject: Novice MicroSoft C5.1 question Keywords: be gentle please Message-ID: <9609@tekigm2.MEN.TEK.COM> Date: 25 Jul 90 23:32:10 GMT Distribution: usa Organization: Tektronix Inc., Beaverton, Or. Lines: 43 Could anyone explain the unexpected output of these two programs to me please?? Being a beginning C person, it's entirely likely that I have a simple syntax error or my concept of pointers is wrong. I am using MicroSoft C5.1 on a '386@16MHz. I posted this once before, but received no help; not even to tell me how stupid I am and that such a simple question is beneath response. As to the question: Running this: #include main() { int x=100; int *y; y= &x; printf("\nx:%d &x:%u",x,&x); printf(" y(add of x):%u",y); printf(" &y(add of y):%u",&y); printf(" *y(value of x):%d\n",*y); } produces the output I would expect: x:100 &x:11094 y(add of x):11094 &y(add of y):11090 *y(value of x):100 But running this: #include main() { int x=100; int *y; y= &x; printf("\nx:%d &x:%u",x,&x); printf(" y(add of x):%u &y(add of y):%u *y(value of x):%d\n",y,&y,*y); } Produces the unexpected output: x:100 &x:11094 y(add of x):11094 &y(add of y):7647 *y(value of x):11090 I do not understand why there is a difference. Could some nice soul explain this in a way a novice could understand?? Thanks in advance.