#include <stdio.h>
#define SIZER 10
#define SIZEC 15
int initconfig(int [][], int, int);
int generate ();
int occ();
int printgrid();
#include <stdio.h>
#define SIZER 10
#define SIZEC 15
int initconfig(int [][], int, int);
int generate ();
int occ();
int printgrid();
Um... you need to not have all that in there twice. That'd be a start.
Code:
int initconfig( int a[SIZER][SIZEC],int i, int j)
{
while( i!= -1)
{
for(i=0; i<=1; i++)
for(j=0; j<=1; j++)
scanf("%d", &a[i][j]);
}
}
No. This is wrong. Your loop will never end.
What exactly are you trying to do? Get user input and when they enter -1 have it stop?
If so, use a do-while loop, or just use a conditional return statement:
Code:
while(1)
{
for()for() //use your for loops similar to above, except have them
//bounry set by the passed arguments. I'm not doing all your
//homework for you.
scanf("%d", a[x][y] )
if( a[x][y] == -1 ) return;
}
}
}
For future reference, give a quick summary of what your code is supposed to do. I refuse to wander off to some random link describing your homework or code project. If you (anyone) want some help, post a bit of code, and explain what you are expecting to happen and what error you're getting.
Quzah.