In what way doesn't it work?
I've made an example. It shows how to re-allocate some already allocated space.
Code:
int row_size = 5;
int *row = (int *)malloc(sizeof(int) * row_size);
*(row+0) = 1;
*(row+1) = 4;
*(row+2) = 5;
*(row+3) = 2;
*(row+4) = 4;
row_size++;
row = (int *)realloc(row, sizeof(int) * row_size);
// After the re-allocation, we can now fill index five, too
*(row+5) = 6;