It is array of arrays, not array of pointers to another arrays.
Arrays are not a pointers. Stack-based multidimensionals arrays are evil. Now you know why.
EDIT: if you have C++11 compiler, following will work:
But you will have memory leak in your transpose function.
EDIT2:: WTF transpose function does? It doesn't even using passed parameters. It uses C-style memory manipulation (discouraged in C++) and on top of that has undefined behavior due to uninitializated variables.
Thank you so much for the response, it is actually only some part of my program, so the variables are not initialized here, that is why i declared them dynamically. and i will try to modify the changes you have told.thank you very much again!!