Advertisement
horselurrver

Index

Aug 4th, 2016
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. int bigindex(double array[], int size);
  3.  
  4. int main(void){
  5.     double array1[]={-23.23,129,90.02,123.123,900.2321};
  6.     printf("The index of the biggest number is %d.\n", bigindex(array1, 5));
  7.     return 0;
  8. }
  9.  
  10. int bigindex(double array[], int size){
  11.     int i, index;
  12.     double biggest=-1000;
  13.     for(i=0; i<size; i++){
  14.         if(array[i]>biggest){
  15.             biggest=array[i];
  16.             index=i;
  17.         }
  18.     }
  19.    
  20.     return index;
  21.    
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement