Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. int main(void)
  2. {
  3. int rows = 2;
  4. int cols = 5;
  5. int **arrayy = malloc(sizeof(int*) * rows);
  6. for (int i = 0 ; i < rows ; i++) {
  7. int *line = malloc(sizeof(int) * cols);
  8. for (int j = 0 ; j < cols ; j++) {
  9. line[j] = i;
  10. }
  11. arrayy[i] = line;
  12. }
  13.  
  14. int n = array_2d_sum(arrayy, rows, cols);
  15. printf("n = %d\n", n);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement