Question: How do I get the following code to compile in C++? I am getting errors: initializing argument 1 of pid_t wait(int*) and: error: invalid conversion

How do I get the following code to compile in C++?

I am getting errors: initializing argument 1 of pid_t wait(int*)

and:

error: invalid conversion from int to int* [-fpermissive]

#include #include #include

using namespace std;

int main () {

int val = 5; int pid;

if (pid = fork()) wait(pid); val++; printf("%d ", val); return val;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!