On Fri, 24 Aug 2007, Brian Dessent wrote: > Anitha Boyapati wrote: > > > Usually, (well I thought so) the argument expected in f() is a pointer > > variable. The above gives the result as 2 for the first call to f()! > > Why is t giving out 2 without being dereferenced in case 1 ? > > You explicity cast an integer into a pointer to an integer. The whole > point of a cast is to tell the compiler to consider one thing as > another. In this case you're telling it that an integer's value is > actually a pointer -- a completely invalid pointer, but a pointer > nonetheless. Alright, you are saying that everything is interpreted as a pointer regardless of the value (valid or invalid). That sounds quite reasonable to me. I guess this sort of usage comes in handy when using pthread_create(...) which demands that arguments to start_routine should be of type (void *). Thanks. > There is no dereference because you didn't ask for a > dereference. Nothing is automatic in C, if you want the address of i > you must write &i. > > Brian > -- Regards, Anitha B @S A N K H Y A