Q: Write a program which defines three integer variables, var1, var2 and var3, & initializing them to the values 100, 200 & 300, it then prints out their addresses.
#include<iostream>
using namespace std;
int main(){
int var1=100;
int var2 = 200;
int var3 =300;
cout<<"The address of var1 is: "<<&var1<<endl;
cout<<"The address of var2 is: "<<&var2<<endl;
cout<<"The address of var3 is: "<<&var3<<endl;
}
Comments
Leave a comment