Thread: "array does not point to an object type"

  1. #1
    Let's do some coding! Welshy's Avatar
    Join Date
    Mar 2005
    Location
    Staffordshire University, UK
    Posts
    168

    "array does not point to an object type"

    hey guys, hope someone can help because im confused about this. I keep getting the error in the title, at the lines ive commented, when i try to compile. I cant see an obvious error, but then again ive only been doing C for 5 weeks, but know basic C++

    Code:
    void displayGrid(int array[][], int points)
    {
    	for(int i = 0; i < points; ++i)
    	{
    		for(int j = 0; j < points; ++j)
    		{
    			if(array[i][j] == 0) // here
    			{
    				printf(" - ");
    			}
    			else
    			{
    				printf(" %d ", array[i][j]); // here
    			}
    		}
    
    		printf("\n");
    	}
    }

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Code:
    void displayGrid(int array[][], int points)
    You can't do that. When you access array, your compiler will complain about incomplete types. You need to specify the rightmost array size (you can only use [] for the leftmost array dimension):
    Code:
    void displayGrid(int array[][SOME_SIZE], int points)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Let's do some coding! Welshy's Avatar
    Join Date
    Mar 2005
    Location
    Staffordshire University, UK
    Posts
    168
    oh, well that's a bit gay and confusing :S thanks though

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. For the numerical recipes in C types!
    By Smattacus in forum C Programming
    Replies: 5
    Last Post: 10-28-2008, 07:57 PM
  2. Class warfare
    By disruptivetech in forum C++ Programming
    Replies: 13
    Last Post: 04-22-2008, 01:43 PM
  3. Header files and classes
    By disruptivetech in forum C++ Programming
    Replies: 5
    Last Post: 04-21-2008, 09:02 AM
  4. trouble with overloaded operator
    By kkurz in forum C++ Programming
    Replies: 2
    Last Post: 10-31-2003, 12:59 PM