about gcc library

Mehdi Khaldi mkhaldi@softaddicts.ca
Tue Apr 8 18:15:00 GMT 2003


Hi,
How to check if a pointer is allocated or not?

I do "if(p == NULL)". This assumes that the developer did "p = NULL;"
But if he didn't do that, how can I know if the pointer is allocated or not?

Example :

Int *p;

If(p == NULL)
	Printf("P = NULL\n");
Else
	Memset(p, 0, sizeof(int));

I'd like to know if the pointer is allocated.

Thanks



More information about the Gcc mailing list