Home > Back-end >  Arr only gave three integers p, why can output all of them
Arr only gave three integers p, why can output all of them

Time:10-01

#include

Int main (void)
{
Int arr []={6};
Int (* p) [3].
Int I, j;
P=arr.
for(i=0; I<2; I++)
{
for(j=0; J<3; J++)
{
Printf (" arr [% d] [% d]=% d \ n ", I, j, p [I] [j]);

}

}



}

CodePudding user response:

2 take 3 to 6.
That is to say, according to the output of two at a time, three times is not enough?

CodePudding user response:

Every time I say a little problem, should be the output of three, two is enough

CodePudding user response:

Int * p [3] three integer pointer variable, and the int (* p) [3] is equivalent to a two dimensional array, the output is below the output of the two dimensional array method,

CodePudding user response:

P=arr. Type mismatch, p points to the number of columns 3 two-dimensional array, and the arr is one dimensional array,

CodePudding user response:

Casts no problem, old-fashioned compiler will not complain,
  • Related