Variable = ExpressionWe know what a variable is, i.e. somewhere to store the value of the expression, but just what is an expression? It's a statement that resolves to a value: either numeric or character.
What Exactly is a Statement?
A statement is a building block of a program. For example the assignment statementint a=10;This is also an expression and has the value 10. If we write this code
int b= (a=10) ;Both a and b will be set to the value 10.
In Lesson 5 we'll meet other statements such as if or while. Both of these require a conditional expression.
Conditional Expression
A conditional expression is one which evaluates as true (a non zero value) or false (0). True is almost always 1 but any non zero value is also true!#include <stdio.h>Compile and run the example above. It should print out the following.
int main() {
int a=10;
int b=( a = 10) ;
int c=( a==10) ;
printf("Value of b is %i\n\r",b) ;
printf("Value of c is %i\n\r",c) ;
return 0; }
Value of b is 10On the next page : Learn about the preprocessor.
Value of c is 1

