User Tools

Site Tools


c_-_c_pointers:address_of_operator

C - C++ Pointers - Address of operator

#include <iostream>
 
using namespace std;
 
int main()
{
  unsigned short varshort=1;
  unsigned long  varlongunsigned= 2;
  long varlongsigned = -3;
  char c='a';
  void *p=&c;
  double d=10;
  cout<<"value for character:\t\t"<<c;
  cout<<"\tAddress of charater:\t\t"<<p;
  cout<<"\nvalue for double:\t\t"<<c;
  cout<<"\tAddress of double:\t\t"<<&d;
  cout << "\nvalue for unsigned short:\t" << varshort;
  cout << "\tAddress of unsigned short:\t" << &varshort << "\n";
  cout << "value for unsigned long:\t"  << varlongunsigned;
  cout << "\tAddress of unsigned long:\t"  << &varlongunsigned  << "\n";
  cout << "value for signed long:\t\t"   << varlongsigned;
  cout << "\tAddress of signed long:\t\t"     << &varlongsigned  << "\n";
 
  return 0;
}
c_-_c_pointers/address_of_operator.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki