Thread: Pointer to a class array?

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    4

    Pointer to a class array?

    Ok, i need some explanation:

    Code:
    MyClass *Human[10][10];
    what does it mean? a pointer to a MyClass array?
    one interesting thing is that i'm able to do that:

    Code:
    for (unsigned int uiRow = 0; uiRow < 10; ++uiRow) {
    			for (unsigned int uiCol = 0; uiCol < 10; ++uiCol) {
    				Human[uiRow][uiCol]	= 0;
    			}
    		}
    but when i tryed this:
    Code:
    int *numbers[10][10];
    
    for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                numbers[i][j] = i*j;
            }
        }
    I get an error: invalid conversion from "int" to "int*"
    Any help?

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It is an array of pointers. You can set a pointer to 0 (NULL).
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    4
    Ok, but what's this then:
    Code:
    int main(int argc, char *argv[])
    array of pointers to char?
    And yet we are able to get out of it main function arguments.

    I thought that
    Code:
    char *argv[]
    is a pointer to a char array, which is pointer to pointer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weird static char pointer array
    By Anator in forum C Programming
    Replies: 4
    Last Post: 11-16-2009, 07:05 AM
  2. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 05:01 PM
  3. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM