C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-13-2010, 06:37 AM   #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?
Peacelyk is offline   Reply With Quote
Old 01-13-2010, 06:42 AM   #2
The larch
 
Join Date: May 2006
Posts: 3,333
It is an array of pointers. You can set a pointer to 0 (NULL).
__________________
I might be wrong.

Quote:
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).
anon is offline   Reply With Quote
Old 01-13-2010, 06:59 AM   #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.
Peacelyk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22