Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. const int a = 3;
  4. int d = 100;
  5.  
  6. void fools(int *m, int l)
  7. {
  8. int count = 0;
  9. for(int i = 0; i < l; i++)
  10. {
  11. for(int j = 0; j < l; j++)
  12. {
  13. if (*(m + i*l + j) == 0)
  14. {
  15. *(m + i*l + j) = d;
  16. count++;
  17. }
  18. }
  19. }
  20. printf("%d\n", count);
  21. }
  22.  
  23.  
  24.  
  25. int main()
  26. {
  27. int mass[3][3] = {{1, 2, 0}, {0, 5, 6}, {7, 0, 9}};
  28.  
  29. fools(*mass, a);
  30. for(int i = 0; i < a; i++)
  31. {
  32. for(int j = 0; j < a; j++)
  33. {
  34. printf("%d", mass[i][j]);
  35. }
  36. printf("\n");
  37. }
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement