Variables are the containers in C language which are used to store data in the program. Variables are the small memory blocks which holds some values in it.
Variables in c language :
What are variables in C language ?
In C language, A variable is just like a container that contains values of different data types. A variable is an entity whose value can be change.
This means that to store any value we use variables in C language. These variables can e imagined as the small memory blocks in which the data is stored of different types. The variables are the one of important components of c language as it is used most frequently inside the programs of C language.
For Instance In our Kitchen we have different containers in which we contain rice, dal, sugar, salt etc. Similarly the variables stores value of a constant.
Example : int a = 9;
int b = 3;
int c = 67;
int b = 3;
int c = 67;
In the above examples a, b, c are the variables and int is their data type (We will discuss the data data type later in further posts) and '=' is assignment operator and 9, 3, 67 are the values assigned to the variables.
Rules for the naming of variables in C language :
- First character of the name of variable should be an Alphabet or ( _ ) underscore.
- No commas or Blank spaces are allowed in the name
- No special symbols or characters are allowed other than ( _ ) underscore.
What are Constants in C language ?
An entity whose value does not change is called constants in C language.
In other words constants are the integers or the values which we put inside the variables.
In other words constants are the integers or the values which we put inside the variables.
Types of Constants :
Primarily there are three types of constants in C language :
- Integer Constant => An integer constant is a constant in which all integers are included such as -1, -5, 3, 5, 7 etc.
- Real Constant => A real constant is a constant in which all real numbers or floating point numbers are included such as 256.32, 3.5, 45.96, 132.5489 etc.
- Character Constant => A character constant is a constant in which all alphabets and special characters are included such as 'a', '$', '@'
A character constant must be enclsoed in single inverted commas.
Keywords in C language :
A keyword in C language are the reserved words for C language programming. These words are a part of the structure of a c language program. These words can never be used for the variable or function or any other nomenclature in c program.
These words are already known and understood by the C compiler.
There are 32 Keywords reserved in C language :
auto double int struct
break long else switch
case return enum typedef
char register extern unuion
const short float unsigned
continue signed for void
default sizeof goto volatile
do static if while
Comments
Post a Comment