Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created November 17, 2008 12:15
Show Gist options
  • Save gnufied/25736 to your computer and use it in GitHub Desktop.
Save gnufied/25736 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int find_max(const int *a,const int length) {
int i,max = a[0];
for(i = 1; i < length; i++)
if(a[i] > max) max = a[i];
return max;
}
int main() {
const int a[] = {10,4,67,12,43,32,12,43,4,5,6};
printf("Maximum number is : %d\n",find_max(a,sizeof(a)/sizeof(int)));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment