Professional Documents
Culture Documents
programmerdouts.blogspot.com/2019/06/blog-post_5.html
VARIABLES
A variable is identifier which stores the data value
it is a symbolic name assigned to the memory location where data is stored
A variable can have only single data item at any given item duration the program
execution
A variable can take different values at different times during execution
assignment of value to a variable is done by the (=) assignment operator
*Note:- (=) operator is not an 'equal operator' that is an assignment operator, equal
operator we will going to see it on further modules
Declaration of variable
In,'C' when we have to use an variable ,first we have to declare it.
void main()
{
/*declaration of variables*/
int v1; // integer type of variable
Initializing of variables
1/3
#include<stdio.h> //header file
void main()
{
/*declaration of variables*/
int v1 = 10; // integer type of variable
void main()
{
/*decleration of variables*/
int v1 = 10; // integer type of variable
Output:
integer variable is 10
float Type variable is 10.12
character Type variable is A
Note:- %d, %c, %f are format specifiers
Specifier Description
2/3
%f stored variable is of float type
3/3