#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
void Alocar(int ***m,int rows,int cols) {
*m = (int **)malloc((rows)*sizeof(int*));
for(int i=0; i<rows; i++) {
(*m)[i] = (int *)malloc(cols*sizeof(int));
}
}
void Modificar(int **m,int rows,int cols) {
for(int i=0; i<rows ; i++) {
for(int j=0; j<cols ; j++) {
m[i][j]= 0;
}
}
cout << " Matriz zerada" << endl;
for(int i=0; i<rows ; i++) {
for(int j=0; j<cols ; j++) {
cout << m[i][j]<< " ";
}
cout << endl;
}
}
int main() {
int **M;
Alocar(&M,10,10);
Modificar(M,10,10);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgQWxvY2FyKGludCAqKiptLGludCByb3dzLGludCBjb2xzKSB7CgoJKm0gPSAoaW50ICoqKW1hbGxvYygocm93cykqc2l6ZW9mKGludCopKTsKCglmb3IoaW50IGk9MDsgaTxyb3dzOyBpKyspIHsKCQkoKm0pW2ldID0gKGludCAqKW1hbGxvYyhjb2xzKnNpemVvZihpbnQpKTsKCX0KfQoKdm9pZCBNb2RpZmljYXIoaW50ICoqbSxpbnQgcm93cyxpbnQgY29scykgewoKCglmb3IoaW50IGk9MDsgaTxyb3dzIDsgaSsrKSB7CgkJZm9yKGludCBqPTA7IGo8Y29scyA7IGorKykgewoKCQkJbVtpXVtqXT0gMDsKCQl9Cgl9Cgljb3V0IDw8ICIgTWF0cml6IHplcmFkYSIgPDwgZW5kbDsKCWZvcihpbnQgaT0wOyBpPHJvd3MgOyBpKyspIHsKCQlmb3IoaW50IGo9MDsgajxjb2xzIDsgaisrKSB7CgoJCQljb3V0IDw8IG1baV1bal08PCAiICI7CgkJfQoJCWNvdXQgPDwgZW5kbDsKCX0KCn0KCmludCBtYWluKCkgewoJaW50ICoqTTsKCglBbG9jYXIoJk0sMTAsMTApOwoJTW9kaWZpY2FyKE0sMTAsMTApOwoKCXJldHVybiAwOwoKfQo=