dimanche 4 juin 2017

Why passing int(*p) [4] as an argument works to get the size of the array inside a function?

I know this is a topic that many people asked before but im still getting confuse about passing an array as argument in a funtion. I want to know what is happening here in these code and why it works fine when i try to get the sizeof the array. thanks and sorry for de inconveniences, here is the code:

#include <iostream>


void function(int* parray,int(*array)[4])  //-> i dont get it
 {

   std::cout << &parray << std::endl;
   std::cout << *parray << std::endl;
   std::cout << *array  << std::endl;
 }

  int main(){

   int array[4]= {2,3,5,4};

   function(array,&array);


   return 0;
}

Aucun commentaire:

Enregistrer un commentaire