- Integers (.......-2,-1,0,+1,+2,..........)
- Floating points (e.g 2.3 ,45.5)
- Characters (e.g 's','a')
For Integers:-
int variable name;
For Floating points:-
float variable name;
For Characters:-
char variable name;
Lets write a simple program that uses variables and prints it value on the screen.
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int num; // "num" is the variable name we can use any name here
num=14; //here we give value to the variable
printf("The value of num = %d",num); //here we print the value of the variable on the screen
getch();
}
Output:-
The value of num = 14
Note:-
"//" this symbol is use to give comments in C and C++ , these comments are not the part of the program it is only written for the guidance of the reader as you can see above.
No comments:
Post a Comment