--- In [email protected], "thides" <[EMAIL PROTECTED]> wrote: > > --- In [email protected], "John Matthews" <jm5678@> wrote: > > > > --- In [email protected], "raj_duttaphookan" > > <raj_duttaphookan@> wrote: > > > > > > In your above explaination, I guess when the getValue( ) function > > > shall be called, it shall be something like: > > > > > > 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. > > > } > > > > Ok, try this one :-) > > > > int main(int argc, char *argv[]) > > { > > int i = 1; > > short s = 2; > > pointer p = (argc > 1) ? &i : &s; > > > > return *p; > > } > > > > In this simple example the compiler could generate code to check the > > value of argc and dereference p correctly, but I don't think it > would > > be practical (possible?) for more complicated examples. > > > > John > > > Is pointer a new data type? What is p? > OK, I found the original thread and now it all makes sense. I hate reading message boards backwards.
Steve
