I am trying to debug this program
Code:
/* Passing an array to a function. Alternative way. */
#include <stdio.h>
#define MAX 10
int array[MAX+1], count;
int largest(int num_array[]);
int main( void )
{
/* Input MAX values from the keyboard. */
for (count = 0; count < MAX; count++)
{
printf("Enter an integer value: ");
scanf("%d", &array[count]);
if ( array[count] == 0 )
count = MAX; /* will exit for loop */
}
array[MAX] = 0;
/* Call the function and display the return value. */
printf("\n\nLargest value = %d\n", largest(array));
return 0;
}
/* Function largest() returns the largest value */
/* in an integer array */
int largest(int num_array[])
{
int count, biggest = -12000;
for ( count = 0; num_array[count] != 0; count++)
{
if (num_array[count] > biggest)
biggest = num_array[count];
}
return biggest;
}
In the "Autos" window, the only variable shown is count, and it's value. Why isn't array[count](and it's value) shown as well? If I was to run the mouse over array[count], I can see it's value, but I would like to see it's value as the program is running. Other programs that I've debugged show ALL values of arrays, and pointers, as they are assigned, so why isn't that happening in this case?
Thanks.