Understanding NULL pointer in C -


i have found in code null pointer defined follows -

#define null ((char *)0) 

i found these code compiles fine. did not understand how works. can please explain how 0 casted char pointer?

and valid use file pointer making null -

file *fp = null; 

the c library macro null value of null pointer constant.it may defined ((void*)0), 0 or 0l depending on compiler vendor. depending on compiler,declaration of null can be

#define null ((char *)0) 

or

#define null 0l 

or

#define null 0 

and valid use file pointer making null--> yes.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -