hello everyone I am trying to create an array that will prompt the user for 5 numbers in the array and simply display them. but I keep geting this error message saying i have too many arguments in my function... please help. here is my code:

#include <iostream>
using namespace std;
 
void  readList(int nums [], int size);
void  printList( int list[1000]);
 
int main()
{
   
     
   int theList[1000];
 
 readList (theList, 5); 
  printList (theList, 5);
  
  return 0;
    
} 
 
void printList( int list[1000])
{
     int i;
     
     for(i = 0; i < 1000; i++)
     
     cout << list[i] << endl;
    
} 

void  readList(int nums [], int size)
{
      int i;
      
      for(i=0; i < 5; i++)
      
      cout << "Enter the " << i + 1 << " number";
      
      cin >> nums[i];
}
void readList(int nums [], int size);
void printList( int list[1000]);

Notice what's different ?

The 1000 isn't actually doing anything useful (nor is it actually harmful either). It certainly has nothing to do with the size of the array being passed.

Also, read the intro threads and how to use code-blocks.

> void readList(int nums [], int size);
> void printList( int list[1000]);
Notice what's different ?

The 1000 isn't actually doing anything useful (nor is it actually harmful either). It certainly has nothing to do with the size of the array being passed.

Also, read the intro threads and how to use

tags.

thank you. I messed around with it and I just forget to include the size in the function prototype.

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.