--- In [email protected], "raj_duttaphookan" <[EMAIL PROTECTED]> wrote: > > main( ) > { > int x; > ..............; > ..............; > int getValue(&x);//the address of x is passed on to the calling > //function. > ..............; > } > > > int getValue(pointer p) //here the address shall come to p > { > return *p; // here it is simply returning the value at the > //address which is contained in p. And since it > //was already defined in main( ) as int x, so > //obviously it shall return an int. > }
Also, what happens if getValue() and main() are in different compilation units? So when getValue() is compiled, the compiler doesn't know anything about where it is being called from and hence the type pointed to by p. John
