i have a function that contain a 2d string array & i need to return the whole array to the main function,but i found that the ordinary return fails, how can i do this?
I dont know what you mean by "the ordinary return fails", there is no reason why it should fail. Though it might be inefficient to return a double dimension array from a function.
its an assignment, i have to return the 2d string, and use its value inside main function ,but when i recall it it show me error that the array is not declared in the main function.
matrix_t* allocate_identity_matrix()
{
matrix_t* m = new matrix_t;
for (unsigned r = 0; r < 4; r++)
for (unsigned c = 0; c < 4; c++)
m[ r ][ c ] = (double)(r == c);
return m;
}