# What is a null statement in C language?



## fun2sh (Jul 12, 2007)

hi guys today my first sem computer exams got over. 
one question in paper was WHAT IS A NULL STATEMENT? how it is useful? can some1 tel me the ans. 
i wrote a statement followed by double semi colon where second semi colon acts like a null statement. m i right?

koi to batao bhai log


----------



## slugger (Jul 12, 2007)

you cud check out the meaning of *Null Statement* from *here*


----------



## Zeeshan Quireshi (Jul 12, 2007)

simply saying a nul statement is a "blank" statement , it absolutely does not do anything , it is terminated like any normal statement by a semicolon ';' .

e.g.

```
int x=5; // this stament is not null
; // this one's null
x=9; //another statement
```


----------



## Manshahia (Jul 12, 2007)

wat is its use then??


----------



## abhishek_del (Jul 12, 2007)

it is like 

int *p=NULL;
here p is a pointer and above statement, initializes a pointer p with null value....this is what is null, nothing else....
It is useful in pointers, to check if they are not inititalized to wrong places or not pointing to places where windows is using the memory..


----------



## casanova (Jul 12, 2007)

It says don't do anything. Used mostly in conditions and loops.


----------



## Zeeshan Quireshi (Jul 12, 2007)

Manshahia said:
			
		

> wat is its use then??


it's used in loops n stuff when you don't want to do anything and the syntax demands that you provide atleast one statement for execution


----------



## Rollercoaster (Jul 13, 2007)

one possible use  in loops

for ( ; ; ) {
....
....
....
}


----------



## fun2sh (Jul 13, 2007)

hey its a blank followed by a semicollon. just like wat i said. i checked on net. i got the result. it seems u guys hav to study C a bit more


----------



## ahref (Jul 13, 2007)

fun2sh said:
			
		

> hey its a blank followed by a semicollon. just like wat i said. i checked on net. i got the result. it seems u guys hav to study C a bit more


I think many of the above post also says same thing.


----------



## tanvi chaturvedi (Jul 13, 2007)

hy was goin thru it... n ques struck in mind..
Q: wats d ASCII value of NULL..
Q: in characters hw to represent NULL.. ?


----------



## ahref (Jul 13, 2007)

ASCII value =0
represented as '\0'


> hy was goin thru it... n ques struck in mind..
> Q: wats d ASCII value of NULL..
> Q: in characters hw to represent NULL.. ?


----------

