About us

Variable in C

Variable in C 

variable-c




Variable is an identifier which holds data of another one variable. It is an identifier whose value can be changed at the execution time of the program. It is used to identify into data in a program.

Rules to declare Variable

Every variable name should start with Alphabets, underscore.
No space is allowed in variables declaration.
The maximum length of a variable is 31 characters or allowed in variables declaration.
No keyword should excess variable name.
In C program variables name always can be used to identify the input or output data.
Except underscore, no other special signs are allowed in the middle of the variable declaration.
Every variable name always should exit in the left-hand side of the assignment operator.

Garbage value

If no input values are assigned by the user into the variable then the system will give a default called garbage value.

Scope of variable

In C language a variable can be either global or local variable.

Global variable

A global variable is defined outside of all functions, generally on the top of the program. The global variable will hold its value throughout the life of program.

Local variable

A local variable is declared within a function or a block. Local variables only use within the function or block where it is declared.



------------------------------------------------------------------------------------------------------------


You can also visit:-