Program mengetahui alamat suatu variabel dalam Pinter dan alamat
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int alif = 5;
float ba =7.5;
double ta = 17.777;
cout<<"============================================== "<<endl;
cout<<" alifbata.cpp "<<endl;
cout<<" Contoh untuk menampilkan alamt suatu variabel "<<endl;
cout<<"============================================== "<<endl;
cout<<endl;
cout<<" Isi variabel :"<<endl;
cout<<endl;
cout<<" alif = "<<alif<<endl;
cout<<" ba = "<<ba<<endl;
cout<<" ta = "<<ta<<endl;
cout<<" \n Alamat variable : "<<endl;
cout<<endl;
cout<<" alif = "<<&alif<<endl;
cout<<" ba = "<<&ba<<endl;
cout<<" ta = "<<&ta<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
simbol pada & dalam program digunakan untuk menampilkan alamat.
tampilan program :
Komentar
Posting Komentar