Variables in C
Variable is a data name which is used to store some data value or symbolic names for storing program
computations and results. The value of the variable can be change during the execution. The rule for naming the variables is same as the naming identifier. Before used in the program it must be declared. Declaration of variables specify its name, data types and range of the value that variables can store depends upon its data types.
Syntax:
int a;
char c;
float f;
Variable initialization
When we assign any initial value to variable during the declaration, is called initialization of variables. When variable is declared but contain undefined value then it is called garbage value. The variable is initialized with the assignment operator such as
Data type variable name=constant;
Example: int a=20;
Or int a;
a=20;
statements
Expressions
An expression is a combination of variables, constants, operators and function call. It can be arithmetic, logical and relational for example:-
int z= x+y // arithmatic expression
a>b //relational
a==b // logical
func(a, b) // function call
Expressions consisting entirely of constant values are called constant expressions. So, the expression
121 + 17 - 110
is a constant expression because each of the terms of the expression is a constant value. But if i were declared to be an integer variable, the expression
180 + 2 – j
would not represent a constant expression.