From the course: C Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Statements and expressions - C Tutorial
From the course: C Essential Training
Statements and expressions
- [Instructor] In C Plus Plus a statement is a unit of code. This is statement .cpp from chapter two of the exercise files. For example, down here on line 13 we have a statement that calls the library function format and assigns its return value to the variable STR. A statement is analogous to a line of code. It may do many things but it's treated as a unit of execution. A statement is always terminated with a semicolon. An expression is anything that returns a value whether or not the value is used. An expression may be part of a statement or it may be an entire statement. Here we have an expression X equals 42. This assigns the value 42. In fact, 42 by itself is an expression. And then this assignment may be considered a statement as well as an expression and you'll notice it's terminated with a semicolon. An expression may be part of a statement or it may be the statement itself. An expression can include operators…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.