Passing an array to a function

How do I pass an array of ints to a function? Getting [Error] invalid conversion from 'int*' to 'int' [-fpermissive], at this line entryQueue.push(Process(inName, inPriority, startingID, inArrivalTime, inBurstIntAR));

Trying to pass in inBurstIntAR, which was declared like this, int inBurstIntAR[ARRAY_SIZE];
Into a constructor, Process(string _pName, unsigned _pPriority, int _processID, int _pArrivalTime, const int fuck[]);

struct Process {
string pName; //name of process

pair<char, int> historyAR[ARRAY_SIZE]; //array of pairs
pair<char, int> historySub; //subscript for history array

unsigned pPriority; //nonnegative, higher values are more important

int processID, //ID for process
pArrivalTime, //indicates when the request for process first arrived
cpuTimer, //counts clock ticks til process reaches end of CPU burst
ioTimer, //counts clock ticks til process reaches end of I/O burst
cpuTotal, //accumulates number of ticks the process spends active
iTotal, //accumulates number of ticks the process spends Iactive
oTotal, //accumulates number of ticks the process spends Oactive
cpuCount, //counts the CPU burst for this process
iCount, //counts the input burst for this process
oCount; //counts the output burst for this process


Process(string _pName, unsigned _pPriority, int _processID, int _pArrivalTime, const int fuck[]);

void increaseCPUTimer();
void increaseIOTimer();

bool operator<(const Process& rhs) const;

};

int main() {
cout << "***** Priority Simulation *****" << endl << endl;

queue<Process> entryQueue; //all processes will be loaded into this queue to start
priority_queue<Process> readyQueue;
priority_queue<Process> inputQueue;
priority_queue<Process> outputQueue;

ifstream inFile; //open text file holding data
inFile.open("data4.txt");

if(inFile.fail()) { //did text file open?
cerr << "Couldn't open text file!" << endl;
return -1;
}

string inString, //string to hold data from text file
inName; //var to hold process name
int startingID = 100, //starting processID
inArrivalTime; //var to hold process arrival time
unsigned inPriority; //var to hold process priority
int inBurstIntAR[ARRAY_SIZE];
char inBurstCharAR[ARRAY_SIZE];

inFile >> inString; //primary read
while(inFile) { //while there's data to be read
if(inString == "STOPHERE") { //exit while loop when STOPHERE process is found
break;
}

inName = inString; //store process name

inFile >> inString; //get next line (priority)
inPriority = stoi(inString); //store process priority

inFile >> inString; //get next line (arrival)
inArrivalTime = stoi(inString); //store process arrival

for(int i = 0; i < 10; i++) {
inFile >> inBurstCharAR[i];
inFile >> inBurstIntAR[i];
}


entryQueue.push(Process(inName, inPriority, startingID, inArrivalTime, inBurstIntAR)); //push new Process object w/ arguments into entryQueue
startingID++;

inFile >> inString; //secondary read
}

inFile.close();

printQueue(entryQueue);

return 0;
}
Last edited on
I see no reason for that to happen. Are you sure this is the code that gives you that error message?
Topic archived. No new replies allowed.