Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int largest(int array[], int size);
- int main(void){
- int array1[]={1,2,3,4,5,6,7,8,9,10,1234,90,12,342,1324,12,34,234,19};
- printf("The largest number in the array is %d.\n", largest(array1, 19));
- return 0;
- }
- int largest(int array[], int size){
- int *ptr;
- int i;
- int biggest=-32768;
- ptr=array;
- for(i=0; i<size; i++){
- if (*ptr>biggest){
- biggest=*ptr;
- }
- ptr++;
- }
- return biggest;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement