OK, the problem you have is that you're not passing the cell arrays defined in main() from one function to another.
Here's an example
So you should just have the old and new generations defined in main(), and the rest of the functions should get visibility of those arrays by passing them around as parameters. Because all arrays are passed as pointers, modifications to the arrays in one function (eg. generate) will be visible in another (eg. print)Code:#include <stdio.h> #define SIZE 9 void generate ( int cell[SIZE][SIZE] ); void print ( int cell[SIZE][SIZE] ); int main(void) { int board[SIZE][SIZE] = { { 0 } }; generate ( board ); print ( board ); return 0; } void generate ( int cell[SIZE][SIZE] ) { cell[5][5] = 5; } void print ( int cell[SIZE][SIZE] ) { printf( "%d\n", cell[5][5] ); }



LinkBack URL
About LinkBacks



.....