Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

A little help with pointers

Name: Anonymous 2011-02-04 15:02


main ()
{
     int A[1][2][3][4];
     //I put random values in it
     G(&A[0][0][0][0]);
}

void G(int *A)
{
     cout << A[2][2][3][4];
}


It says me "Invalid type 'int[int]' for array subscript"... Why?

Name: Anonymous 2011-02-04 15:15

Nope. The problem is that if i use, it works...

cout<<*(A+1*2*3*4*sizeof(int)+2*3*4*sizeof(int)+3*4*sizeof(int)+4*sizeof(int))


I read in a book that this code should work, but it doen's work for me.

void G(int *A)
{
     int n=A[1][2][3][4];
     cout << n;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List