A variable name can contain letters, digit and underscore (_). It cannot begins with a digit. C is case sensitive, therefore v and V are considered two different variable names. Its data type is given to specify what type of data can be stored in the variable.
There are four basic data types in C programming language: int, float, double and char. Each data type has its own size. The size of a variable is the memory space allocated in the memory required to store its value.

The statements declare four variables of types int, float, double and char with the name of num1, num2, num3 and letter. Now that we have declared the variables, lets look at how to initialize them.

We use '=' (assignment operator) to initialize the variables such as the value of 5 into variable num1. We could also perform the declaration and initialization on a single statement. This is demonstrated in the following program.
0 comments:
Post a Comment