There are still a lot of errors in your code, and I'm surprised your compiler isn't
complaining more about the code you posted, which compiler are you using might
I ask?
I'm not going to fix errors for you, but instead try and help you figure them out for
yourself, and so I've composed a few "intelligent" questions that might help you
find answers:
1. What's going on here? What is it that you are attempting to achieve with this
code?
Code:
if (feof (NULL) != 0)
{
endvalue = counter;
return 1;
}
else
{
counter = counter + 1;
}
2.
int i = 0;
int j = 0;
int data [i];
you were already told that the array declaration is a bit dodgy. Now, assuming that
your compiler actually allows this statement, why would you declare an array to hold
0 elements?
3. What happens if a user enters more than one valid command, eg -max 42 456 2 -min ...?
4. The values entered are in argv, which is a char **, now where in your program do
you access these values, better still, where do you convert them into their correct types?
5.
maximum = -2147482648;
minimum = 2147482648;
can you guarantee that maximum and minimum can store values that big? Can you
think of a better way to find the maximum/minimum of a set of numbers?
You should also look at all the occurances of "data [i]" in your code - as established
already there is no information in this variable, but your code assumes otherwise