Taxidriver
Programmer
Hello, I have a program which accepts ten numbers in input and stores them in an array.
This program contains a function that should calculate the maximum of these 10 numbers;
the function however doesn't work and I can't understand why.
Can anybody help me? I use ANSI standard.
Thanks in advance.
#include <stdio.h>
#include <alloc.h>
main()
{
int i,array[10],max;
for (i=0; i<=9; ++i)
array=0;
for (i=0; i<=9; ++i)
{
printf("\nintroduci numero "
scanf("%10d", &array);
}
max=maximus(array);
printf("\nIl massimo e': %10d", max);
}
maximus(vector)
int vector[];
{
int i, top;
top=vector[0];
for (i=1; i<=9; ++i)
{ if (vector > top)
top= vector;
}
return top;
}
This program contains a function that should calculate the maximum of these 10 numbers;
the function however doesn't work and I can't understand why.
Can anybody help me? I use ANSI standard.
Thanks in advance.
#include <stdio.h>
#include <alloc.h>
main()
{
int i,array[10],max;
for (i=0; i<=9; ++i)
array=0;
for (i=0; i<=9; ++i)
{
printf("\nintroduci numero "
scanf("%10d", &array);
}
max=maximus(array);
printf("\nIl massimo e': %10d", max);
}
maximus(vector)
int vector[];
{
int i, top;
top=vector[0];
for (i=1; i<=9; ++i)
{ if (vector > top)
top= vector;
}
return top;
}