Saturday, 18 February 2017

C++ program of finding size and address of variable

In this program we will learn how to find address and size of variable.
The code is given below.

//Code starts

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
          float x=1265.234;
          int y=12389;
         
          cout<<"Float: "<<x<<"\n";
          cout<<"Address of "<<x<<"= "<<&x<<endl;
          cout<<"Size of "<<x<<"= "<<sizeof(x)<<endl;
         
          cout<<"Integer: "<<y<<"\n";
          cout<<"Address of "<<y<<"= "<< &y<<endl;
          cout<<"Size of "<<y<<"= "<<sizeof(y);
          getch();
}

//Code ends


Share:

0 comments:

Post a Comment