I cant find whats wrong to this program... im new to C... Please help.

#include <stdio.h>
#include "genlib.h"
#include "simpio.h"

#define size 5
#define size2 3

void getArray (int numbers[][]);
void checkArray (int numbers[][],int space[][]);

int main()
{ 
	int numbers[size][size], i, c, x, y;
	bool space[size][size];

	for (i=1; i<size; i++)
	{
		for (c=1; c<size; c++)
		{
		numbers[i][c] = 0;
		space[x][y] = false;
		}
	}

	getArray(numbers);

	printf("The elements that are larger than their neighbors are:\n");

	for (i=1; i<size2; i++)
	{
		for (c=1; c<size2; c++)
		{
		if(space[i][c] = true)
		{
			printf("%d in location (%d,%d)",numbers[i][c],i+1,c+1);
		}
		}
	}
	
	system("pause");
}

void getArray(int numbers[][])
{
	int i,c;
	for (i=1; i<size2; i++)
	{
		for (c=1; c<size2; c++)
		{
			printf("Enter integer (higher than 0) for space %i,%c:\n");
		numbers[i][c]=GetInteger();
		}
	}
}

void checkArray (int numbers[][],int space[][])
{
	int c, x, y;

for (x=1; y<size; y++)
{
	for (y=1; y<size; y++)
	{
		numbers[x][y] = c;
		if(c < numbers[x+1][y+1] && c < numbers[x-1][y-1] && c < numbers[x+1][y] && c < numbers[x][y+1] && c < numbers[x-1][y] && c < numbers[x][y-1] && c < numbers[x-1][y+1] && c < numbers[x+1][y-1])
		{
		space[x][y] = true;
		}
	}
}
}
1>------ Build started: Project: neighbors, Configuration: Debug Win32 ------
1>Compiling...
1>neighbors.cpp
1>d:\program files\microsoft visual studio 9.0\vc\include\simpio.h(44) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        d:\program files\microsoft visual studio 9.0\vc\include\string.h(157) : see declaration of 'strncpy'
1>d:\program files\microsoft visual studio 9.0\vc\include\simpio.h(57) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        d:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>d:\program files\microsoft visual studio 9.0\vc\include\simpio.h(98) : warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        d:\program files\microsoft visual studio 9.0\vc\include\stdio.h(324) : see declaration of 'sscanf'
1>d:\program files\microsoft visual studio 9.0\vc\include\simpio.h(135) : warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        d:\program files\microsoft visual studio 9.0\vc\include\stdio.h(324) : see declaration of 'sscanf'
1>d:\program files\microsoft visual studio 9.0\vc\include\simpio.h(172) : warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        d:\program files\microsoft visual studio 9.0\vc\include\stdio.h(324) : see declaration of 'sscanf'
1>d:(8) : error C2087: 'numbers' : missing subscript
1>d:(9) : error C2087: 'numbers' : missing subscript
1>d:(9) : error C2087: 'space' : missing subscript
1>d:(25) : error C2664: 'getArray' : cannot convert parameter 1 from 'int [5][5]' to 'int [][1]'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:(43) : error C2087: 'numbers' : missing subscript
1>d:(56) : error C2087: 'numbers' : missing subscript
1>d:(56) : error C2087: 'space' : missing subscript

#define _CRT_SECURE_NO_WARNINGS Put this at the very start of your program - the first line in fact.

> error C2087: 'numbers' : missing subscript
> void getArray (int numbers[][]);
You're only allowed to leave the left-most one empty.
All the other subscripts need a size.

> space[x][y] = false;
What are x and y initialised to at this point?
If it's garbage, then your program will blow up.

> for (i=1; i<size; i++)
Was it your intention to leave the top row and left column uninitialised?
Arrays start at 0, not 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.