Is a null statement a null pointer?
Infrequently Asked Questions in comp.lang.cNo. A null pointer is a pointer where all of the address bits are zero (no matter what the segment bits are), and can be obtained by typing '(char *) (int) 0'. A null statement is not a pointer to anything. They are not interchangeable, although you can combine them to get an effectively-null statement, such as NULL;. This does not buy you anything. [a] Send large donations, checks, and money orders to the author of the FAQ, or the moderator of the group, whichever you prefer.
Is there more than one null statement?
Infrequently Asked Questions in comp.lang.cSort of. You can use '';'', ''0;'', or ''1;'' - they will all act like a null statement. Only the first is a ''true'' null statement (all bits zero). They are basically equivalent. Note that (void *) 0; is a null statement of type pointer to void, for instance. [a] No. { statement-list[opt] } is a compound statement. An empty block is not the same as a null statement, however, although it can be used in many of the same places. It's really a null block.
What is this infamous null statement, anyway?
Infrequently Asked Questions in comp.lang.cA null statement is an expression statement consisting solely of the terminating semicolon. The optional expression is dropped. It can be distinguished from any other statement by byte count or study of side-effects.
How do I ''get'' a null statement in my programs?
Infrequently Asked Questions in comp.lang.cIn ANSI C, there are six types of statements; labeled statements, compound statements, expression-statements, selection statements, iteration statements, and jump statements. All of them, except the jump and expression statments, are defined in terms of optional preceeding text, and other statements. The jump statements are never null statements. An expression statement is considered to be ''a null statement'' if the optional expression part of it has been left out.
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
OOPS FAQ - Page 7Latest Answer: NULL pointer is pointer which is not pointing to anything in the memory. NULL is defined as (v...
What is this infamous null pointer, anyway?
The C Language FAQThe language definition states that for each pointer type, there is a special value -- the "null pointer" -- which is distinguishable from all other pointer values and which is not the address of any object. That is, the address-of operator & will never yield a null pointer, nor will a successful call to malloc.
How do I "get" a null pointer in my programs?
The C Language FAQAccording to the language definition, a constant 0 in a pointer context is converted into a null pointer at compile time. That is, in an initialization, assignment, or comparison when one side is a variable or expression of pointer type, the compiler can tell that a constant 0 on the other side requests a null pointer, and generate the correctly-typed null pointer value.
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
OOPS FAQ - Page 7Latest Answer: NULL is a macro which contains the value 0 (on most implementations). this is the one used to initia...
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Memory AllocationIt's hard to say. The Standard doesn't say that systems can act this way, but it doesn't explicitly say that they can't, either. (Such a ''deferred failure'' implementation would not seem to conform to the implied requirements of the Standard.) The conspicuous problem is that, by the time the program gets around to trying to use the memory, there might not be any. The program in this case must typically be killed by the operating system, since the semantics of C provide no recourse.
This is strange. NULL is guaranteed to be 0, but the null pointer is not?
Frequently Asked Questions: C Language (abridged)A "null pointer" is a language concept whose particular internal value does not matter. A null pointer is requested in source code with the character "0". "NULL" is a preprocessor macro, which is always #defined as 0 (or ((void *)0)).
I'm confused. NULL is guaranteed to be 0, but the null pointer is not?
The C Language FAQThe conceptual null pointer, the abstract language concept defined in question 1.1. It is implemented with... The internal (or run-time) representation of a null pointer, which may or may not be all-bits-0 and which may be different for different pointer types. The actual values should be of concern only to compiler writers. Authors of C programs never see them, since they use... The source code syntax for null pointers, which is the single character "0". It is often hidden behind..
If NULL and 0 are equivalent as null pointer constants, which should I use?
Null PointersMany programmers believe that NULL should be used in all pointer contexts, as a reminder that the value is to be thought of as a pointer. Others feel that the confusion surrounding NULL and 0 is only compounded by hiding 0 behind a macro, and prefer to use unadorned 0 instead. There is no one right answer. (See also questions 9.4 and 17.10.) C programmers must understand that NULL and 0 are interchangeable in pointer contexts, and that an uncast 0 is perfectly acceptable.
