Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

malloc contiguous 2d array

int **A = malloc(ROWS * sizeof(int*));
A[0] = malloc(ROWS * COLS * sizeof(int));
for(int i = 1; i < ROWS; i++) 
   A[i] = A[i-1] + COLS;
// use A[i][j]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #malloc #contiguous #array
ADD COMMENT
Topic
Name
1+3 =