there are some problems in my coding which showing errors C2664 and C2562. i have no idea how to fix it...wish someone can point the problems and solutions too...

#include <iostream>

using namespace std;

const int listSize = 10;

void fillArray(int list[],int listSize);
void largest(const int list[],int listSize);
void printArray (const int list[], int listSize);

int main()
{
	int a;
	int b;

	cout<<"please enter the number pancakes that eaten by 10 peoples."<<endl;
	
	fillArray(a,b);
	printArray(a,b);

		return 1;
}

void fillArray(int list[], int listSize)
{
	int index;

	for(index=0;index<listSize;index++)
		cin>>list[index];
}

void printArray(const int list[],int listSize)
{
	int index;

	for(index=0;index<listSize;index++)
		cout<<list[index]<<" ";
}

void largest(const int list[],int listSize)
{
	int index;
	int maxIndex=0;

	

	for (index =1; index<listSize;index++)
		if (list[maxIndex]<list[index])
			maxIndex=index;

	return maxIndex;
}

Recommended Answers

All 2 Replies

Stop writing code that causes C2664 and C2562 errors would be a usable suggestion.

That might mean looking up what the errors mean and either memorizing the descriptions & sulutions or writing them down for future reference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.