ccplusplus.com
Learn C, C++ Concepts
Saturday, April 7, 2012
2 dimensional array in c++ example
/******************************************************************* * File : 2d_array_dynamic_allocation.cpp * Author : Team ccplusplus * Description : 2 dimensional array in c++ example * Date : AM 12:28 07 April 2012 * Source : http://www.ccplusplus.com/p/c_15.html * Note : *******************************************************************/ #include
using namespace std; int main() { int row, col; int **array; //array name int i, j; cout<<"Enter the matrix size i.e. row and column"<
>row; cin>>col; //allocate memory of size row to pointer to int array = new int*[row]; //allocate memory of size col to each of the pointer to int for(i=0; i
>array[i][j]; } } cout<
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment