0
# include <stdio.h>
# include <conio.h>
# include <time.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
	int start;
	int last;
# define SIZE 10
	int largest (int num[],int msize);
	int smallest(int num[],int asize);
int main()
{
	int num[10]={0};
	int i;
	int min;
	int max;
	int pick;
	int pickk;
	int smallest;
	int largest;
	int temp;
	srand(time(NULL));
	for (i=0;i<10;i++)
	{
		num[i]= 1 + rand()%100;
		printf("%d\n",num[i]);
	}

	pick=smallest(num,10);
	printf("%d",pick);
	pickk=largest(num,10);
	printf("%d",pickk);

	for (i=0;i<10;i++)
	{
	printf("%d\n",num[i]);
	}
	getch();
}



int smallest(int num[],int asize)
{
	int i;
	int min;
	min=num[0];
	for (i=1;i<asize;i++)
	{
		if (num[i]<min)
			min=num[i];
	}
	return min;
}

int largest(int num[],int msize)
{
	int i;
	int max;
max=num[0];
	for (i=1;i<msize;i++)
	{
		if (num[i]>max)
			max=num[i];
	}
	//printf("\nMax#: %d\n",max);
	return max;
}

im getting the error
Function array.cpp(31): error C2064: term does not evaluate to a function taking 2 arguments

Function array.cpp(33): error C2064: term does not evaluate to a function taking 2 arguments

Can someone please tell me where im going wrong thanks

Edited by slygoth: n/a

3
Contributors
3
Replies
7
Views
6 Years
Discussion Span
Last Post by slygoth
Featured Replies
  • 1
    jonsca 1,059   6 Years Ago

    You have redeclared "smallest" and "largest" as ints in main(). There's no need to do that. Read More

  • 1

    It would help if you posted your code in CODE tags. As well has having functions called smallest and largest you also have variables (int) called smallest and largest. Read More

1

You have redeclared "smallest" and "largest" as ints in main(). There's no need to do that.

Comments
thanks man this really help
1

It would help if you posted your code in CODE tags.

As well has having functions called smallest and largest you also have variables (int) called smallest and largest.

Edited by happygeek: fixed formatting

Comments
Thanks this helps
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.