Advertisement
apl-mhd

pointerMaxInaArray

Dec 17th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char **argv)
  4. {
  5.    
  6.    
  7.     int str[100] = {0,20,30,01,1,2,3,-1,100};
  8.    
  9.     int *p, n, max;
  10.    
  11.     n=20;
  12.     max=0;
  13.    
  14.     p = str;
  15.    
  16.    
  17.     for(n=0; n<9; n++){
  18.        
  19.        
  20.         if(*(p+n) > max )
  21.        
  22.             max =  *(p+n) ;
  23.  
  24.         }
  25.        
  26.        
  27.         printf("max = %d\n", max);
  28.    
  29.    
  30.        
  31.    
  32.    
  33.    
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement