>First of all, an Array is NOT a pointer, nor is a 2D Array a pointer to a pointer.
This is a very touchy subject, the relationship between arrays and pointers is close enough to drive people mad when dealing with the errors. It's best to remember that arrays and pointers are not the same, most of the time.
>functionname(Array[row_needed][cell_needed]);
Yes and no, while the 2nd - nth dimensions require a size with array notation, the first dimension is optional:
Code:
#include <iostream>
void function ( char array[][5], int row, int col )
{
for ( int x = 0; x < row; x++ )
std::cout<< array[x] <<" ";
std::cout<<"\n";
}
int main ( void )
{
char a[4][5] = {"This","is","a","test"};
function ( a, 4, 5 );
return 0;
}
>thereby rendering it a global variable and you will not have to pass its value
Global variables are usually considered a bad thing because they can be accessed by any function in the program. This destroys any data hiding, which is a key factor in C++.
>They are interchangeable
Only in very specific situations, such as passing them as arguments to functions.
-Prelude