Skip to content

Instantly share code, notes, and snippets.

@lseongjoo
Last active December 12, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lseongjoo/4706074 to your computer and use it in GitHub Desktop.
Save lseongjoo/4706074 to your computer and use it in GitHub Desktop.
// ERROR!
void printArray(int arr[][])
{
for(int i=0; i<2; i++)
for(int j=0; j<3; j++)
cout << a[i][j] << " ";
cout << endl;
}
#include <iostream>
using std::cout;
using std::endl;
void printArray(int[][3]);
int main()
{
// 2 x 3
int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};
printArray(arr);
}
void printArray(int arr[][3])
{
for(int i=0; i<2; i++)
for(int j=0; j<3; j++)
cout << a[i][j] << " ";
cout << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment