Re: Find the size of a datatype




Keith Thompson wrote:
"vire" <Avic.Go@xxxxxxxxx> writes:
Chris Dollin wrote:

yes ,it is true that NULL is a macro . but what is a macro ?

A name that when used is replaced by (the macro-expansion of) its
replacement text. Surely you know that?
so you get a constant 0 if you use NULL. right?
then in
int *p=NULL;
p is a null pointer
and
int *p=(int*)0x13ff7c;
p is point to address 0x0013ff7c;

i think the null pointer is indeed point to some place(the address
0).but we just call it null.
and we can not read or write on address 0.is that right?

No.

Section 5 of the comp.lang.c FAQ, <http://www.c-faq.com/>, has a good
explanation of this. After you've absorbed that, read section 4, then
the rest of the FAQ.
many thaks to
Chris Dollin, Richard Bos, Flash Gordon, and Keith Thompson.
i think i should have read through the faq and the standard before i
post a new message.
now i am reading them.thank you all guys for your helpful advices.

.



Relevant Pages

  • Re: printf("%p ", (void *)0);
    ... Keith Thompson writes: ... > output to show both the value of the pointer and, say, the first few ... > bytes of the memory it points to. ... and others read the FAQ." ...
    (comp.lang.c)
  • Re: Find the size of a datatype
    ... A name that when used is replaced by (the macro-expansion of) its ... replacement text. ... i think the null pointer is indeed point to some place(the address ... Keith Thompson kst-u@xxxxxxx ...
    (comp.lang.c)
  • Re: Detect direction of stack growth
    ... Hi Keith Thompson, ... > Of course there can be meaningful ordering of pointer values on many ... could check it for potential pointers to heap allocated objects in order ... garbage collector and tacking easier issues. ...
    (comp.lang.c)
  • Re: 3.2 update needed
    ... >> even as a replacement for something better. ... hardly expect them to with all relevant wiki pages continually. ... >If a wiki javascript faq were monitored by a number of knowledgeable people, ... CRON job to fire only on Mondays, and start a new CRON job for Fridays - ...
    (comp.lang.javascript)
  • Re: int a[17]; int b = -1; /* a[17] same as b guaranteed in ANSI C? */
    ... > is not an element of an array behaves the same as a pointer to the ... > object as its element type. ... Keith Thompson kst-u@mib.org ...
    (comp.lang.c)