#include <stdio.h>
#include <stdlib.h>
void mostrarMatriz(int **matriz, int linhas, int colunas)
{
int i,j;
for (i = 0; i < linhas; ++i){
for (j = 0; j < colunas ; ++j){
}
}
}
int main()
{
int linhas = 2, colunas = 5, i;
int **matriz
= (int **) malloc(sizeof (int*) * linhas
);
for (i = 0; i < linhas; ++i){
matriz
[i
] = (int*)malloc(sizeof (int) * colunas
); }
matriz[0][1] = 10;
matriz[1][3] = 10;
mostrarMatriz(matriz, linhas, colunas);
matriz
= (int**) realloc(matriz
, sizeof(int*) * ++linhas
); matriz
[linhas
-1] = (int*)malloc(sizeof (int) * colunas
); matriz[linhas-1][0] = 5;
mostrarMatriz(matriz, linhas, colunas);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnZvaWQgbW9zdHJhck1hdHJpeihpbnQgKiptYXRyaXosIGludCBsaW5oYXMsIGludCBjb2x1bmFzKQp7CiAgICBpbnQgaSxqOwogICAgcHJpbnRmKCJcblxuTWF0cml6OlxuXG4iKTsKCiAgICBmb3IgKGkgPSAwOyBpIDwgbGluaGFzOyArK2kpewogICAgICAgIGZvciAoaiA9IDA7IGogPCBjb2x1bmFzIDsgKytqKXsKICAgICAgICAgICAgcHJpbnRmKCIlZCAiLCBtYXRyaXpbaV1bal0pOwogICAgICAgIH0KICAgICAgICBwcmludGYoIlxuIik7CiAgICB9Cn0KCgppbnQgbWFpbigpCnsKICAgIGludCBsaW5oYXMgPSAyLCBjb2x1bmFzID0gNSwgaTsKICAgIGludCAqKm1hdHJpeiA9IChpbnQgKiopIG1hbGxvYyhzaXplb2YgKGludCopICogbGluaGFzKTsKCiAgICBmb3IgKGkgPSAwOyBpIDwgbGluaGFzOyArK2kpewogICAgICAgIG1hdHJpeltpXSA9IChpbnQqKW1hbGxvYyhzaXplb2YgKGludCkgKiBjb2x1bmFzKTsKICAgIH0KCiAgICBtYXRyaXpbMF1bMV0gPSAxMDsKICAgIG1hdHJpelsxXVszXSA9IDEwOwogICAgbW9zdHJhck1hdHJpeihtYXRyaXosIGxpbmhhcywgY29sdW5hcyk7CgogICAgbWF0cml6ID0gKGludCoqKSByZWFsbG9jKG1hdHJpeiwgc2l6ZW9mKGludCopICogKytsaW5oYXMpOwogICAgbWF0cml6W2xpbmhhcy0xXSA9IChpbnQqKW1hbGxvYyhzaXplb2YgKGludCkgKiBjb2x1bmFzKTsKICAgIG1hdHJpeltsaW5oYXMtMV1bMF0gPSA1OwogICAgbW9zdHJhck1hdHJpeihtYXRyaXosIGxpbmhhcywgY29sdW5hcyk7CgogICAgcmV0dXJuIDA7Cn0KCg==