Public feed #601727

Someone

public c v1 · immutable
Raw Edit
·published 2007-07-03 17:55 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>int main(void){    size_t row = 3;    size_t col = 3;    int **array = malloc(row * sizeof(int *));         // allocate memory for the two dimensional array    for(int i = 0; i < row; i++)        *(array + i) = malloc(col * sizeof(int));        // fill the two dimensional array with values    for(int i = 0; i < row; i++)            for(int j = 0; j < col; j++)                *(*(array + i) + j) = i;    // print out the two dimensional array    for(int i = 0; i < row; i++)	for(int j = 0; j < col; j++)        {	    if(j % col == 0)                printf("\n\t");            printf("[%d]", *(*(array + i) + j));        }    printf("\n\n");    return 0;}