dynamically generating 2d array in cpp
int** a = new int*[rowCount];
for(int i = 0; i < rowCount; ++i)
a[i] = new int[colCount];
dynamically generating 2d array in cpp
int** a = new int*[rowCount];
for(int i = 0; i < rowCount; ++i)
a[i] = new int[colCount];
two dimensional dynamic array c++
int ** two_dim_array(int row_num, int col_num)
{
int **two_dim_array=(int **)malloc(sizeof(int *)*row_num);
int i, j;
for(i=0:i<row_num;i++)
{
two_dim_array[i]=(int *)malloc(sizeof(int)*col_num);
for(j=0:j<col_num;j++)
two_dim_array[i][j]=0;
}
return two_dim_array;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us