mardi 31 octobre 2017

How does the code given below works?

A thumb rule in C++ says "There shall be no references to references, no arrays of references, and no pointers to references"

#include <iostream>

int main()
{
  int n=9;
  int * a= &n;
  int &b =n ;
  int &c = b;
  int *d = &b ;  
  std:: cout << "\n" << n << " - "  << *a << " - " << b <<" - "  << c  << " - "<< *d << std::flush; 
}

Aucun commentaire:

Enregistrer un commentaire