Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void make_mat(int ***matrix, int n) {
- *(matrix) = (int **) malloc(n * sizeof(int *));
- int it;
- for (it = 0; it < n; it++)
- (*(matrix))[it] = (int *) malloc(n * sizeof(int));
- }
- int main() {
- int **matrix, it, ij, n = 10;
- make_mat(&matrix, n);
- for (it = 0; it < n; it++)
- for (ij = 0; ij < n; ij++)
- matrix[it][ij] = it + ij;
- for (it = 0; it < n; it++)
- for (ij = 0; ij < n; ij++)
- printf("%d\n", matrix[it][ij]);
- return 0;
- }
Add Comment
Please, Sign In to add comment