What are typical uses of null statement
;
in C ?
I know that it is basically used to skip expression where it is expected by the compiler, but here I'm interested only in real-world examples of such use cases.
for ( i = 0; i < 10; line[i++] = 0 ) ; In this example, the loop expression of the for statement line[i++] = 0 initializes the first 10 elements of line to 0. The statement body is a null statement, since no further statements are necessary.
The NULL statement is an executable statement that does nothing. The NULL statement can act as a placeholder whenever an executable statement is required, but no SQL operation is wanted; for example, within a branch of the IF-THEN-ELSE statement.
To write a null hypothesis, first start by asking a question. Rephrase that question in a form that assumes no relationship between the variables. In other words, assume a treatment has no effect. Write your hypothesis in a way that reflects this.
An empty statement is used when you no need to perform an operation where a statement is required. It simply transfers control to the end point of the statement. It is also very useful with a while loop with the blank body and label statements.
It's typically the side-effect of a code block that was stripped by the preprocessor, like
#if DEBUG #define ASSERT(_x) Assert(_x) #else #define ASSERT(_x) #endif ASSERT(test); // Results in null statement in non-debug builds
That, or in loops where your condition already contains whatever needs to be done in each iteration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With