What does (char *) 0 mean?

This is a question related to this question: What does (char *) 0 mean in c?

There, the answers deviated slightly from the explanation that it was the answer, but in the final answer it was mentioned that it was a pointer to a character at address 0 and that it was null. This caused me two doubts.

  • In c, can we give char * 9 and say that it is a pointer to address 9? Will we get an error or warning?

  • Well let's say that (char *) 0 is really a pointer to a character at address 0, but what does this address 0 mean? I mean, how can we say this is zero? In this case, will the value be (char *) 1 or (char *) 2, etc.?

Edit: Just to say whether this helps or not. My initial search for this question occurred when I found out that the last argument in the execllinux system call was zero, and I saw a rather strange syntax for it: (char *) 0.

Thank.

+4
source share
1 answer

(char *) 0 " 0". C (char *) 0 - char *. - char. ( "" ) , 0. . (char *) 0 , "" 0xFFFFFFFF, , char *. , , .

(char *) 9 . , (char *) 9, . char * 9.

(char *) 0, -

int i = 0;
(char *) i;

(char *) i ( ) char * 0. , , , 0 .

+11

All Articles