Thread: Displaying A Multidimensional Array

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    14
    Yeah, I understand that the array starts at one, but I only want to display the 3x3 set of values that is in the center of the array. The other two rows are only present to make it easier for me to use the check_neighbors function I created, so that I wouldn't have to alter it or add unnecessary ifs into it for values with less than eight neighbors, but the program still gives me the error. I was wondering more about why I might get the strange output of -858993460. Thanks again for any help.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    If you do not want to display the first and last entry
    Code:
    void displayArray(int ne[][size]) {
    	int i,j;
    	for (i=1;i<size-1;i++);          //remove semicolon
    	{
    		for (j=1;j<=size-1;j++) // should be j<size-1
    		{
    			printf("%4d",(ne[i][j]));
    		}
    		printf("\n");
    	}
    }
    Kurt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. question about multidimensional arrays
    By richdb in forum C Programming
    Replies: 22
    Last Post: 02-26-2006, 09:51 AM
  3. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  4. displaying a board with 2D array
    By axon in forum C++ Programming
    Replies: 9
    Last Post: 03-07-2003, 07:59 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM