Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the difference between an expression and a statement [duplicate]

Tags:

c

syntax

Possible Duplicate:
Expression Versus Statement

What does expression mean? Something that evaluates to something, returns a value?

How is it different from a statement. Can a statement contain an expression and vice versa?

like image 951
Suleman Avatar asked Oct 02 '10 17:10

Suleman


1 Answers

Expressions do "return" a value, though they may be cast to (void). Statements don't evaluate to anything and only have side effects.

E.g. ; is a statement by itself, evaluates to nothing, and has no side effects.

like image 129
Frédéric Hamidi Avatar answered Nov 15 '22 22:11

Frédéric Hamidi