Hi all, > sorry for silly question again. > > in *(int * )0=0 > > we are dereferencing the NULL pointer coz' Sure we do. > (int *)0 is pointer to NULL It's THE NULL pointer. (NULL is not a variable, so there is no pointer TO NULL). > and *(int *)0 is what we called dereferencing the ptr, > > but about syntax > > (int *)0 --> how compiler interprets it while > parsing phase or in any complex pointer assignment > can anybody explain this syntax? Type in parenthesis (eg. (int *)) is a typecast operator. Thus 0 (which is a constant of type int) is cast to (int *). Casting integeral type to pointer means to intepret the integeral value as an Is this not sounds better, when we say (int *)0 this is casting counter 0 to pointer pointer is variable,and this indiactes this is pointing nowhere. and when we dereference it kernel makes oops,coz of pointing to region which not exist!!! --- Preetham D Naik <pdn@sasken.com> wrote: > i am thinking on the lines of a compiler.... > i feel the compiler wud basically associate 0 with a > variable(virtually > speaking) and it wud mean that > (int*)ZERO. > now the compiler wud associate the variable ZERO > with the address 0...i.e., > (int *)0 > now pointer to that location is set to zero. > *(int*)ZERO = 0; > which is nothing but > *(int *)0 = 0; > now the contents of the variable wud be set to 0 or > null; > Thank You, > rgrds. > EOM > > "prasanna wakhare" <prasannawakhare@yahoo.com> wrote > in message > 20040123062201.85582.qmail@web14424.mail.yahoo.com">news:20040123062201.85582.qmail@web14424.mail.yahoo.com... > > Hi all, > > sorry for silly question again. > > > > in *(int * )0=0 > > > > we are dereferencing the NULL pointer coz' > > > > (int *)0 is pointer to NULL > > and *(int *)0 is what we called dereferencing the > ptr, > > > > but about syntax > > > > (int *)0 --> how compiler interprets it while > > parsing phase or in any complex pointer assignment > > can anybody explain this syntax? > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free web site building tool. > Try it! > > http://webhosting.yahoo.com/ps/sb/ > > > > -- > > Kernelnewbies: Help each other learn about the > Linux kernel. > > Archive: > http://mail.nl.linux.org/kernelnewbies/ > > FAQ: http://kernelnewbies.org/faq/ > > > > > *********************************************************************** > > PLEASE VISIT US AT STAND E13B, AT 3GSM WORLD > CONGRESS 2004, CANNES. > > ******************************************************************** > > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/