Friday, January 26, 2024

VARIABLES IN C

Variables



variable is a named location in the computer’s memory In C programming. That is used to contain a value which can be modified by a program. variable can be form by numerical value and lower-case upper-case characters. But variable first characters can not be form in numerical value or underscore. The names of the variables are case-sensitive. variables have a data the programmer while identity the variable and should give the name type associated with them. 

 

Variable of declaration

When a variable is declared, an instruction is given to the compiler to reserve a storage space in the memory for the variable.  The syntax the declare variables are var_1,var_2, … ,var_n.

For example,
 int total;

Float x,y;

Char ch,abc;

Initialization of Variable


When a variable is declared, the initial value of the variable is undefined. So, the value of the variable should be initialized to a known value after declaring it. Examble of initialization of

Variable:

Float rate=2.59;

Short int breadth=130;

Long int wage=5200;

Char ch =’a’;

Unsigned int num =15u;

Long int value =5461464l;

 

0 comments:

Post a Comment