Hi guys, I need some help with arrays.

#include <iostream>
#include <ctime>
using namespace std;

void constructArray (int [], int);
void printArray (int [], int);

const int MAX = 30;
int sizeArray = rand() % MAX;

int main()
{
    srand(time(NULL));
    
    int makeArray [sizeArray];
    
    constructArray [makeArray, sizeArray];
    printArray [makeArray, sizeArray];
    
    system ("pause");
    return 0;
    
}

void constructArray (int makeArray [], int size)
{
     for (int i = 0; i < size; i++)
     makeA [i] = rand () % size;
     
     
 }
 
void printA (int makeArray [] , int size)
{
     for (i = 0; i < sizeA; i++)
     cout << makeA[i] << " ";
     
     
 }

I keep getting a compile error when trying to run it.
I think that my declaration is wrong but can't figure out what's wrong.
Thanks for helping.

Edit: Forgive my eyesight, spotted the [] instead of ()
Haha...

Hi guys, I need some help with arrays.

#include <iostream>
#include <ctime>
using namespace std;

void constructArray (int [], int);
void printArray (int [], int);

const int MAX = 30;
int sizeArray = rand() % MAX;

int main()
{
    srand(time(NULL));
    
    int makeArray [sizeArray];
    
    constructArray [makeArray, sizeArray];
    printArray [makeArray, sizeArray];
    
    system ("pause");
    return 0;
    
}

void constructArray (int makeArray [], int size)
{
     for (int i = 0; i < size; i++)
     makeA [i] = rand () % size;
     
     
 }
 
void printA (int makeArray [] , int size)
{
     for (i = 0; i < sizeA; i++)
     cout << makeA[i] << " ";
     
     
 }

I keep getting a compile error when trying to run it.
I think that my declaration is wrong but can't figure out what's wrong.
Thanks for helping.

Edit: Forgive my eyesight, spotted the [] instead of ()
Haha...

Function call operator is () not []. There are few undeclared variables and some variables with incorrect names.

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.