Search 82,174 tutors

Introduction to variables in C programming

A variable in any name (x) that we assign a value to. The name of the variable and its value are store in the memory of the computer.

Example 1.

F is the name of a variable, 10 is its value, F=10.
F is a variable because we can change the value of F at anytime in the program. F = 10+1 =11


Based on what (value, data) the variable will store, it will be identified as such.

F = 10, 10 is a whole number or integer. then F is variable that hold integer. F is identified as an integer.

Now we can write:

Example 2.

int F =10. variable integer F is equal to 10.

char F ="Marc." variable Character F is equal to Marc.

String F= " Marc is a good tutor." String variable F is equal to Marc is a good tutor.


int, char, String are call identifier because they identify the variable F. They are many identifiers in C++ such as FLOAT, DOUBLE, LONG, *CONST. etc...

*exception, if you declare a variable as constant (const F = 5), you can not change the value of F later.