Skip to content

Commit

Permalink
did assignment 14
Browse files Browse the repository at this point in the history
  • Loading branch information
Coursera Learner committed Jun 23, 2020
1 parent 5a47e9c commit a70c9a9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion 14_array_max/arrayMax.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
#include <stdlib.h>

int * arrayMax(int * array, int n) {
return NULL;
if (n<=0)
return NULL;
int i=0;
for (int j=i+1; j<n; j++)
{
if (array[i]< array[j])
i=j;
}

return array+i;
}

void doTest(int * array, int n) {
Expand Down

0 comments on commit a70c9a9

Please sign in to comment.