C/C++: Affecter un tableau à un pointeur

Author:

 pointeur, adresse
Download


#include 

using namespace std;

const int Lengh = 3;

int main ()
{
      int tab[] = {10, 9, 8, 7, 6
                ,5, 4, 3, 1, 0};

	  int size=sizeof(tab)/sizeof(tab[0]);

	  /* Le nom du tableau est un pointeur */
   int* pointeur_int = tab;

   for (int i = 0; i < size; i++)
   {
      cout<<"Adresse de l'index "<< i << "="<< & pointeur_int[i]
      << ", sa Valeur= " << pointeur_int[i] << endl;
   }
   return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *