Advertisement
lukasd

zadanie 1 zestaw 10

Dec 17th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. int* sed(int a[], int s, int b)
  2. {
  3.     int *pa;
  4.  
  5.     for (int i = 0; i < s; i++)
  6.     {
  7.         a[i] = rand() % 90 + 10;
  8.         if (a[i] == b)
  9.         {
  10.             pa = &a[i];
  11.             return pa;
  12.         }
  13.        
  14.     }
  15.     pa = NULL;
  16.     return pa;
  17.    
  18. }
  19. void kolos1()
  20. {
  21.     int a[20];
  22.     int s;
  23.     int b;
  24.     int *ptr= (sed(a, 20, 10));
  25.     if(ptr!=NULL)
  26.     {
  27.         printf("%d",*ptr);
  28.     }
  29.     else
  30.     {
  31.         printf("NULL" );
  32.     }
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement