1. ## Array problem

I am writting a program that you enter intergers and am using a find minimum and max functions however I seem to be having a problem when I mix positive and negative # or use a zero. I think I am jusl overlooking the obvious and help is much appreciated.
include <stdio.h>

#define MAX_SIZE 25

{
int size = 0;

while (size < MAX_SIZE && scanf("%d", &array[size]) == 1)
++size;

return size;
}

void print(int array[], int size)
{
int i;
for (i = 0; i < size; ++i)
printf("%5d", i);
printf("\n");
}

int findmax(int array[], int size)
{
int max = 0;
int i;

for (i = 0; i < size; ++i)
if (max < array[max])
max = i;

return max;
}

int findmin(int array[], int size)
{
int min = 0;
int i;

for (i = 0; i < size; ++i)
if (min > array[min])
min = i;

return min;
}
int main()
{
int array[MAX_SIZE];
int size;

printf(" Title: #7\n");
printf(" By: \n");

printf("Enter array: ");

printf("Minimum value: %d\n", array[findmin(array, size)]);
printf("Maximum value: %d\n", array[findmax(array, size)]);
}

2. Step through your findmax function yourself (using maybe [-2, 4, 3] for an array) and you'll see pretty quickly what's gone wrong.

3. ## backwatds

When I run those # its backwards but if I use 1 3 5 it works

4. ## backwards

Code:
```int findmax(int array[], int size)
{
int max = 0;
int i;

for (i = 0; i < size; ++i)
if (max > array[max])
max = i;

return max;
}

int findmin(int array[], int size)
{
int min = 0;
int i;

for (i = 0; i < size; ++i)
if (min < array[min])
min = i;```
By switching them max > and min < it works ecept when I enter a zero or mit it all up

5. I'd try something like this
Code:
```int findmax(int array[], int size) {
int max = 0;
int i;

for (i = 0; i < size; ++i)
if (array[max] < array[i])
max = i;
return max;
}```
same problem with findmin.
Kurt

Works great