C++ Data Types & Variables
Data Type tells compiler that what kind of data we are using if we need to perform Addition between two or multiple Numbers we'll use int (INTEGER), double (point value) , or other data types depending on our requirements. We use data type with variables or as a method return type.
if we need to take Name of a Student or any Character combination of Alphabets then we'll use String or char data type.
Variables are those names which are use to store values of different data types.
value of a variable can be vari it depends on our need.
in C++ every variable of different data type take memory space of heap memory or stack memory to store values of different data types.
if we need to take Name of a Student or any Character combination of Alphabets then we'll use String or char data type.
Variables are those names which are use to store values of different data types.
value of a variable can be vari it depends on our need.
in C++ every variable of different data type take memory space of heap memory or stack memory to store values of different data types.
Example Program of Variables and data types
Example
Data Types
Variables
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- string name = "ITECH TALEEM";
- int rollNum = 101 ;
- cout<<"Name : "<<name<<"\n RollNumber : "<<rollNum;
- return 0;
- }
Console :
Name : ITech Taleem
RollNumber : 101
Comments
Post a Comment