Re: how a pointer to null works .



"sachin dooble" <sachin.dooble@xxxxxxxxx> writes:
> ranjan
> not very much sure but in turbo there will be compilation error.
> u can't have int *p=0 since here u have only declaration not
> definition .
> so u are trying to increase a undefined pointer .
> also in 4th line u are printing the value of the pointer in
> decimal format which will be in -ve
> this is because address should be printed in %u or %x form.
> so overall there will be a compilation error that's what i
> feel.
> Do inform me plz

Context, dammit! Don't assume that your readers can see the article
to which you're replying.

If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.

And please don't use abbreviations like "u" for "you" and "-ve" for
"negative". They just make what you write more difficult to read.

If you had been following this newsgroup, you would have seen this
advice many many times.

The code in the original post was:

#include<stdio.h>

int main()
{
int *p = 0;
++p;
printf("%d",p);
return 0;
}

There's actually nothing in that program that would cause a
compilation error (did you try it?). There are two instances of
undefined behavior. See Jack Klein's followup for a good explanation.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: This is the end
    ... > and show things in a naturally temporal order? ... The correct way to post a followup is to quote *only* ... wants to re-read should be relegated to the bottom of the article, ... readers a favor and just don't post it ...
    (comp.lang.c)
  • Re: question about pointer define
    ... If you want to post a followup via groups.google.com, ... "Reply" at the bottom of the article headers. ... For each new poster, it's the first time; ...
    (comp.lang.c)
  • Re: Why reply at the bottom of posts?
    ... >>>I'm just curious as to why so many replies are under the original post ... >> Ctrl-End to get to the bottom of the message instantly. ... Steve Winograd, MS-MVP (Windows Networking) ... Please post any reply as a follow-up message in the news group ...
    (microsoft.public.windowsxp.general)
  • Re: AddSourceFilterForMoniker() locks up sometimes.
    ... > of different functions to make it easier to see the serial execution. ... >> Does AMcap have any trouble repeatedly capturing from it? ... This would be useful information to put in your original post. ... (Otherwise, don't expect a followup) ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: please tell the websites
    ... The groups.google.com interface is broken. ... If you want to post a followup via groups.google.com, ... "Reply" at the bottom of the article headers. ... If you can get a copy of _The C Programming Language_, 2nd edition, by ...
    (comp.lang.c)