Advertisement
Sam-Sampaio

Exemplo

Mar 23rd, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. // Author: Sam Sampaio
  4.  
  5. int func(int *pointer, size_t tam) {
  6.  
  7.      int i, count = 1, size = 0;
  8.  
  9.      for(i=0; i < tam-1; i++) {  
  10.          if(pointer[i] < pointer[i+1]) {
  11.  
  12.              count++;
  13.  
  14.              if(size < count)
  15.                  size = count;
  16.          } else
  17.  
  18.             count = 1;
  19.      }
  20.         return size;
  21.  
  22. }
  23.  
  24. int main(void){
  25.  
  26.        int array[16] = {1,2,3,4,5,1,1,1,2,3,4,16,17,18,18,20};
  27.  
  28.        printf("%d\n", func(array,16));
  29.  
  30.        return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement