## jralexander137 Light Poster

I'm trying to find the largest int in an array and then print it out to the screen. Here is what I have so far:

``````void LargeNumber(int numbers[], int k){
int len = k;
int i = 0;
int big_num = 0;
for(i=0; i<len; i++) {
printf("i is: %d\n", i);
if(numbers[big_num] > numbers[i]){
big_num = numbers[i];
}
if(numbers[big_num] <= numbers[i]){
printf("Still looking for largest number. \n");
}
}
printf("The largest number is: %d\n", big_num);

}``````

What am I doing wrong? I think it's to do with the comparison between big_num and i but I am having a brain fart and can't work through it. Any help/input would be greatly appreciatted!

## jralexander137

I figured it out...

All I had to do was set big_num = numbers.

:)

## dkalita 110

I'm trying to find the largest int in an array and then print it out to the screen. Here is what I have so far:

``````void LargeNumber(int numbers[], int k){
int len = k;
int i = 0;
int big_num = 0;
for(i=1; i<len; i++) {
printf("i is: %d\n", i);
if(numbers[big_num] < numbers[i]){
big_num = i;
}
if(numbers[big_num] >= numbers[i]){
printf("Still looking for largest number. \n");
}
}
printf("The largest number is: %d\n", numbers[big_num]);

}``````

What am I doing wrong? I think it's to do with the comparison between big_num and i but I am having a brain fart and can't work through it. Any help/input would be greatly appreciatted!