Free programming examples and instructions

C Variables

What are variables in c programming

by Athil

Posted on 24 Jan 2017 Category: C Views: 977

Edited on 03 Jun 2017

Variables are the name given to a storage location for coding. Variables are used to store values in computer memory for computation. Each variable in C has a type and It must be declared at the top of the program code. Type determine the size and the data type of the variable. for example, If we need to store a number we can use number data types.

Rules of declaring variable names

Rules of naming variable are as follows

1. Must begin with a letter, Underscore(_) 

2. Contains only numbers, characters and digits. special characters are not accepted except underscore(_).

3. Never use a keyword as a variable.

4. The maximum length of variable is 31 and minimum length of variable is 1.


Some valid variable names are 







Invalid Variable names are






Declaring a variable

Declaring variable in c are easy. A variable declaration consist of data type followed by variable names separated by commas and end with a semicolon (;). assigning value to a variable is also possible at the time of declaration itself.

syntax of declaring variable 

<datatype> <variable name> , ..... ;


int a;

int age = 70; 

char c;

float f ;

int a,b,c;




Leave a Comment: