VARIABLE
Variables is a named memory location in the computer to store the data.
(Or)
Variable is a data name to a data value.
Note: Assigning names to the data is useful for further usage in the application. It is only possible to work with same kind of data when it is having unique names.

The Programming language C has two main variable types
- Local Variables
- Global Variables
Local Variables
- If we declare any variable within the block or function called as local variable.
- Local variables scope is confined within the block or function where it is defined.
- Local variables must always be defined at the top of a block.
- When a local variable is defined – it is not initialized by the system, you must initialize it yourself.
- When execution of the block starts the variable is available, and when the block ends the variable ‘dies’
Global Variables
- If we declare any variable to outside of all the functions comes under global variable.
- Global variable is defined at the top of the program file and it can be visible and modified by any function that may reference (scope) it.
- Global variables are initialized automatically with some default values according to its type at the time of compilation.
Data Type | Default Value |
int | 0 |
char | '\0' |
float | 0.000000 |
#include<stdio.h>
#include<conio.h>
int a,b;
float f;
char ch;
void main()
{
int c=10,d=20;
clrscr();
printf(“a=%d\nb=%d\nf=%f\nch=%c\nc=%d\nf=%d”,a,b,f,ch,c,d);
}
Rules for constructing variable names
- A Variable name consists of any combination of alphabets, digits and underscores.
- The length of identifier may be up to 31 characters but only the first 8 characters are significant by compiler
- (Note: Some compilers allow variable names whose length may be up to 247 characters. But, it is recommended to use maximum 31 characters in variable name. Large variable name leads to occur errors.)
- The first character of the variable name must either be alphabet or underscore. It should not start with the digit.
- No commas and blanks are allowed in the variable name.
- No special symbols other than underscore are allowed in the variable name
- We need to declare the type of the variable name before making use of that name in the program.
- Lower case variables and upper case variables of same name treat differently (case sensitive).
- Variable name should not match with a keyword, because keywords are the reserved words to do their own tasks such as do, while, int, for…….
C Identifiers
- “Identifiers” or “symbols” are the names you supply for variables, types, functions, and labels in your program.
- Identifier names must differ in spelling and case from any keywords.
- You cannot use keywords as identifiers; they are reserved for special use.
- A special kind of identifier, called a statement label, can be used in goto statements.
- The first character of an identifier name must be a non-digit.
Keywords
- Keywords are the system defined identifiers.
- All keywords have fixed meanings that do not change.
- White spaces are not allowed in keywords.
- Keyword may not be used as user definer identifier.
- It is strongly recommended that keywords should be in lower case letters.
- There are totally 32(Thirty Two) keywords used in a C programming

Escape Sequence Characters (Backslash Character Constants) in C
C supports some special escape sequence characters that are used to do special tasks. Some of the escape sequence characters are as follow:
Example codes on escape sequences:
void main()
{
clrscr();
printf(“%d%d\b\b%d”,1,2,3);
getch();
}
void main()
{
char str[20]=”naresh tech”;
clrscr();
printf(“%s\r%c”,str,’N’);
getch();
}