Constants ,Variable and Keywords
In any programming language we need to follow some fundamaental rules which makes program easy to understand the developer or different developers who are working in that project.
Today we are into basic funda of C programming
1. Constants
Constants are three types Integer Constants (10,20,30,40) , Real Constants (10.2,20.3,30.4) and Character Constants ('a','b','1','2')
2. Variables :
A variable is an entity that does change.
Variable : the value can be changed during program execution.
Take an example we are placing an object either book or fruit somewhere on table or bowl.
then it occupies some space that space is nothing but Memory in programming terminology.
That memory may vary depending on the Object so it can occupy total table or bowl.
So basic point it we can increase or decrease the object but it should be less than the bowl or table.
[next]
Variable can store upto some maximum numbers or characters depending on the type of the variable.
Every variable will have some memory (collection of memory cells). and every memory will have a memory address to access during run time or execution time.
X (123456) 50
Here
X is variable name given to the memory location
123456 is memory location
50 is the value in memory location 123456 which is refered by a variable "X".
We have different types of variables like Integers, Floating Point and Character constant.
Integer will store only integer values without decimal part
Floating point will store values with decimal points
Character constants stores set of character values
Keywords :
Every language will have one type of meaning.
eg : int , float, if, char are different types of predefined keywords.
Integer :
which is defined by using keyword "int"
Eg: int a;
int salary;
Floating Point :
which is defined by using keyword "float"
Eg :
float x;
float StudentPercentage;
Character :
which is defined by using char keyword
Eg:
char ch;
char name;
Note : you cannot declare varable with name as int, float,if,char it throws an error.

Comments
Post a Comment