I'm trying to return a pointer to the new process that was just created, but i get an error because it's a void function. So what is the correct syntax? -Thanks
process *allocate_pcb(); // This is the prototype. It's required so that you can call this function
int main()
{
process *pcb = allocate_pcb();
cout << pcb; // The ouput is the value of the pointer
return 0;
}
process *allocate_pcb() // Needs to match the prototype
{
process *pcb = new process;
assert(pcb != NULL);
return pcb;
}
C++ is strongly typed. It's required to provide always the type.