ok I guess the tutorial i am reading is shady,
it says that:
Code:
void procedure (int myarray[][3][4])
is a valid function prototype
but when I try
Code:
void printarray( int arr[] [4] [4],int verlen = 3,int horlen = 3);
int x[4][4];
int main(void)
{
for (int b(0);b<5;b++){
for(int c(0); c<5; c++){
x[c][b] = c;
}
}
printarray(x,4,4);
cin.get();
}
void printarray( int arr[] [4] [4],int verlen,int horlen){
for(int x(0);x<=verlen; x++){
for(int y(0); y<=horlen;y++){
cout<< arr[x][y];
}
cout<<"\n";
}
}
it gives me an error but...
Code:
void printarray( int arr [4] [4],int verlen = 3,int horlen = 3);
int x[4][4];
int main(void)
{
for (int b(0);b<5;b++){
for(int c(0); c<5; c++){
x[c][b] = c;
}
}
printarray(x,4,4);
cin.get();
}
void printarray( int arr [4] [4],int verlen,int horlen){
for(int x(0);x<=verlen; x++){
for(int y(0); y<=horlen;y++){
cout<< arr[x][y];
}
cout<<"\n";
}
}
is fine...