Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

function for 2d dynamic array

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #dynamic #array
ADD COMMENT
Topic
Name
9+9 =