hamaXD

CPT lab03-03

Sep 4th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include<stdio.h>
  2. #define LEN 5
  3.  
  4. int* max(int *a, int *b);
  5. int main(){
  6.   int d[LEN], i;
  7.   for(i = 0; i < LEN; i++){
  8.     printf("N%02d: ", i + 1);
  9.     scanf("%d", &d[i]);
  10.   }
  11.   int *x=max(&d[0], &d[1]);
  12.   printf("%d\n",*x);
  13.   return 0;
  14. }
  15. int* max(int *a, int *b){
  16.     int i,*min ;
  17.     *min = *a;
  18.     for(i=0;i<LEN;i++){
  19.         if(*min <*(b+i)){
  20.             *min=*(b+i);
  21.         }
  22.     }
  23.     //printf("%d\n",*min);
  24.     return min;
  25. }
Add Comment
Please, Sign In to add comment