c - Is the NULL pointer implicitly converted to type (int*) when we use "if(ptr==NULL)" for an integer pointer ptr? -
i know null pointer (void*)0.but happens when use statements following:
if(ptr==null) where ptr can char,float or int pointer?is null guaranteed implicitly converted type on left as, example, in c, type returned malloc() void* implicitly converted type of lvalue?
is null guaranteed implicitly converted type on left? [...]
yes.
according section 6.3.2.3.4 of iso/iec 9899:2011 c programming language standard:
conversion of null pointer pointer type yields null pointer of type. 2 null pointers shall compare equal.
and section 6.3.2.3.1
a pointer void may converted or pointer object type. a pointer object type may converted pointer void , again; result shall compare equal original pointer.
Comments
Post a Comment