Saturday, February 18, 2012
sample program to avoid confusion with auto and register storage classes....
//Program tested on Microsoft Visual Studio 2008
#include<iostream>
using namespace std;
int main()
{
int i = 123;
auto int j = 456;
register int k = 789;
cout<<"Address of i = " << &i <<", Value = " << i << endl;
cout<<"Address of j = " << &j <<", Value = " << j << endl;
cout<<"Address of k = " << &k <<", Value = " << k << endl;
return 0;
}
Subscribe to:
Posts (Atom)