Re: Printing a NULL pointer
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Wed, 15 Jun 2005 12:11:00 GMT
junky_fellow@xxxxxxxxxxx wrote:
> Is there any way by which user can determine what is the internal
> representation for a NULL pointer ? I am asking this because,
> sometimes during debugging the memory dump is analysed. In that
> case it would be difficult to find it is a NULL pointer or not.
/* BEGIN new.c */
#include <stdio.h>
int main(void)
{
void *pointer = NULL;
size_t byte;
for (byte = 0; byte != sizeof pointer; ++byte) {
printf(
"byte %lu is 0x%u\n",
(long unsigned)byte,
(unsigned)((unsigned char *)&pointer)[byte]
);
}
puts(
"There may be more than one "
"representation for a null pointer."
);
return 0;
}
/* END new.c */
--
pete
.
- References:
- Printing a NULL pointer
- From: junky_fellow
- Re: Printing a NULL pointer
- From: Lawrence Kirby
- Re: Printing a NULL pointer
- From: junky_fellow
- Printing a NULL pointer
- Prev by Date: Re: Address on x- byte boundary
- Next by Date: Re: padding mechanism in structures
- Previous by thread: Re: Printing a NULL pointer
- Next by thread: Re : Printing a NULL pointer
- Index(es):
Relevant Pages
|