Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. void GetMax(int* a, int size, int* max){
  4.         *max = *a;
  5.         int i;
  6.         i=0;
  7.         for (i=1;i<size;i++)
  8.         {
  9.                 if ( *max < a[i] ) *max = a[i];
  10.          
  11.         }
  12. }
  13.  
  14. #define Na 5
  15.  
  16. int main()
  17. {
  18.         int i;
  19.         int a[Na] = {10, 20, -3, 60, 1};    
  20.         int max = 0;
  21.         GetMax(&a[0], Na, &max );
  22.         printf( "max: %d\n",  max);
  23.         getch();
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement