hi all. im new to c++, trying to teach myself from internet tutorials... its slow progress. anyway i wanted to make a program to solve a puzzle. i havent even got on to writing an algorithm for working it out yet. im stuck trying to make a function that prints a 9x9 2 dimentional array. heres the complete program
its more than likely that im going about this all the wrong way. my compiler saysCode:#include <iostream> using namespace std; void print_table(int array); int main() { int table[9][9]; for(int i=0;i<9;i++) { for(int ii=0;ii<9;ii++) { table[i][ii] = 0; } } int *ptr; ptr = table; print_table(ptr); cin.get(); } void print_table(int array) { for(int i=0;i<9;i++) { for(int ii=0;ii<9;ii++) { cout << *array[i][ii] << "|"; } cout << "- - - - - - - - -" << endl; } }
18 C:\Dev-Cpp\Untitled1.cpp cannot convert `int[9][9]' to `int*' in assignment
so im assuming it has something to do with the fact that i dont know how to pass an array to a function, im just guessing. thanks in advance for help. first post here