Advertisement
lukasd

poprawa kolokwium zadanie 1

Feb 15th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. bool func(int **arr,int size,int size2)
  2. {
  3.             if (arr[0][0] != 0 && arr[size-1][0] != 0 && arr[0][size2-1] != 0 && arr[size-1][size2-1] != 0)
  4.             {
  5.                 return TRUE;
  6.             }
  7.             else
  8.             {
  9.                 return FALSE;
  10.             }
  11.        
  12. }
  13. void kolos1()
  14. {
  15.     int size = 4;
  16.     int size2 = 4;
  17.     int **arr= (int**)malloc(sizeof(int*)*size);
  18.     for (int i = 0; i < size; i++)
  19.     {
  20.         arr[i] = (int*)malloc(sizeof(int)*size2);
  21.     }
  22.     for (int i = 0; i < size; i++)
  23.     {
  24.         printf("\n");
  25.         for (int j = 0; j < size2; j++)
  26.         {
  27.             arr[i][j] = rand() % 100;
  28.             printf("%d ", arr[i][j]);
  29.         }
  30.     }
  31.     arr[0][0] = 0;
  32.     printf("\n%d\n", func(arr, size, size2));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement