PDA

View Full Version : What is a null statement in C language?


fun2sh
12-07-2007, 07:12 PM
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
12-07-2007, 08:00 PM
you cud check out the meaning of Null Statement from here (http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_072.HTM)

Zeeshan Quireshi
12-07-2007, 08:11 PM
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
12-07-2007, 08:27 PM
wat is its use then??

abhishek_del
12-07-2007, 08:41 PM
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
12-07-2007, 09:03 PM
It says don't do anything. Used mostly in conditions and loops.

Zeeshan Quireshi
12-07-2007, 09:09 PM
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
13-07-2007, 04:36 AM
one possible use in loops

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

fun2sh
13-07-2007, 06:34 AM
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:mrgreen:

ahref
13-07-2007, 08:24 AM
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:mrgreen:
I think many of the above post also says same thing.

tanvi chaturvedi
13-07-2007, 07:27 PM
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
13-07-2007, 07:36 PM
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.. ?