TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Kurt Kuzba
from: Rob Swindell
date: 2003-09-10 14:22:46
subject: Pointers

Re: Pointers
  By: Kurt Kuzba to All on Mon Sep 08 2003 02:44 am

 >     The inclusion of the NULL macro in stddef.h is part of the
 >  standard, so it is easy to check your compiler to see if NULL is
 >  equal to zero.  It should be, but the standard does not specify
 >  that it is.  If you are faced with an unknown compiler, you can
 >  just look at stddef.h to see, or you can run a bit of code to
 >  find out.
 > 
 > /*   seenull.c  Public Domain test of the value of NULL   */
 > #include 
 > int main (void)
 > {
 >     char* test = NULL, buf[16];
 >     printf("test = %p.\n", test);
 >     fgets(buf, 16, stdin);
 >     return 0;
 > }

Or, more simply:

int main(void)
{
    printf("NULL=%p\n",NULL);
    getchar(); /* better than fgets */
    return 0;
}

                                                  digital man

Snapple "Real Fact" #175:
In 1634, tulip bulbs were a form of currency in Holland. 
--- SBBSecho 2.00-Win32
* Origin: Vertrauen - vert.synchro.net (1:103/705)
SEEN-BY: 633/267 270
@PATH: 103/705 218/903 10/3 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.