how the address are compared?Code:void func(int * p) { printf("%s\n", p < (int*)(&p) ? "GREAT" : "LESS"); }
how the address are compared?Code:void func(int * p) { printf("%s\n", p < (int*)(&p) ? "GREAT" : "LESS"); }
As pointers to int, I suppose. In what context did you see this code, or did you just come up with it yourself?Originally Posted by dpp
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Which in this case is the address of the local variable created for this function, to which p is assigned inside this function call:Code:#include<stdio.h> void func( int *p ) { printf( "%p, %p\n", (void*) p, (void*) &p ); } int main( void ) { int x; int *p = &x; printf( "%p, %p\n", (void*) p, (void*) &p ); func( p ); return 0; }
Quzah.
Hope is the first step on the road to disappointment.