Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int **arr = (int**) malloc(rows);
- for(size_t i = 0; i < cols; ++i) {
- arr[i] = (int*) malloc(cols);
- }
- for(size_t i = 0; i < rows; ++i) {
- for(size_t j = 0; j < cols; ++j) {
- arr[j] = num; // (1)
- }
- }
- for(size_t i = 0; i < rows; ++i) {
- free(arr[i]);
- }
- free(arr);
- // строка (1) эквивалентна: *(*(arr + rows) + cols) = num
Advertisement
Add Comment
Please, Sign In to add comment