There are expression;selection;jump;iteration;label;block statements. Is follwoing expression statement?
int a;
There are expression;selection;jump;iteration;label;block statements. Is follwoing expression statement?
int a;
Nope, it isn't a statement.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
then what int a; is?
A declaration of a variable.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I think int a; is a statement in C. Still I am not getting the satishfactory answer
>> I think int a; is a statement in C. Still I am not getting the satishfactory answer
Well, the answer you got is the correct one.
Statements in C are expressions of the form
left = right;
Sorry, it's anticlimactic.
Well, if you want a concise explanation of all the lexical definitions in C, look at this page:
http://www.jaggersoft.com/csharp_grammar.html
Ok, so it's for C-sharp, but it's so similar that I think we can take it as "the same" for this purpose.
According to that, the line you show is a declaration statement.
But declaration statement isn't in your list, so I guess that's not a valid answer to your question.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
http://en.wikipedia.org/wiki/Stateme...programming%29
Many languages (eg, C) make a distinction between statements and definitions, with a statement only containing executable code and a definition declaring an identifier.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens