Advertisement
Le_BuG63

Tuyaux

Dec 9th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. __int32_t   get_max(__int32_t *arr, __int32_t nelem) {
  5.     __int32_t   max = 0,
  6.                 index;
  7.    
  8.     for( ; index < nelem; ++index )
  9.         if( arr[index] > max )
  10.             max = arr[ index ];
  11.     return max;
  12. }
  13.  
  14. int main(void) {
  15.     __int32_t   npipe,
  16.                 *arr_pipe = NULL;
  17.     int         i;
  18.    
  19.     scanf("%u", &npipe);
  20.    
  21.     arr_pipe = malloc(npipe * sizeof(__int32_t));
  22.    
  23.     for(i = 0 ; i < npipe; i++ )
  24.         scanf("%u", &arr_pipe[i]);
  25.        
  26.     printf("%u", get_max(arr_pipe, npipe));
  27.    
  28.     free(arr_pipe);
  29.    
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement