1
#include<stdio.h>
int main() {
    int *p=NULL;
    if (p == NULL) {
        printf("%x",*p );
    }
    return 0;
}

If I can, How? If I can't, What value in it?

1 Answers1

2

No, you cannot in general dereference a NULL pointer, that gives undefined behavior.

That's sort of the point, so this idea is a bit strange.

Note that this doesn't mean that your code won't run on any platform or produce a result, but it still violates the language specification so the result from running it on some particular implementation doesn't matter.

unwind
  • 391,730
  • 64
  • 469
  • 606