Connecting Tech Pros Worldwide Forums | Help | Site Map

what's wrong with my code func(ptr **) when passing double array

puzzlecracker
Guest
 
Posts: n/a
#1: Jun 27 '08


f(int** x)
{


}


int main (){

int array[4][5];

f(array);

}



thanks

Ian Collins
Guest
 
Posts: n/a
#2: Jun 27 '08

re: what's wrong with my code func(ptr **) when passing double array


[put the question in the body as well as the heading]

puzzlecracker wrote:
Quote:
>
f(int** x)
{
}
>
int main (){
>
int array[4][5];
>
f(array);
}
>
http://c-faq.com/aryptr/pass2dary.html

--
Ian Collins.
Juha Nieminen
Guest
 
Posts: n/a
#3: Jun 27 '08

re: what's wrong with my code func(ptr **) when passing double array


puzzlecracker wrote:
Quote:
>
f(int** x)
{
>
>
}
>
>
int main (){
>
int array[4][5];
>
f(array);
>
}
Your f() function expects an array of pointers, but your 'array' does
not contain pointers, it just contains ints. (The fact that your array
of ints can be double-indexed doesn't make it an array of pointers.)

There are no pointers anywhere in 'array', thus it cannot be converted
into an array of pointers.
Closed Thread