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>
int main()
{
int var1 = 100;
int var2 = 200;
int var3 = 300;
std::cout << "&var1 = " << &var1 << '\n';
std::cout << "&var2 = " << &var2 << '\n';
std::cout << "&var3 = " << &var3 << '\n';
}
Comments
Leave a comment