Question: What does the following program output? #include #include using namespace std; void outodd ( ) { for ( int i = 1 , i <
What does the following program output?
#include
#include
using namespace std;
void outodd
for int i i ; i
cout i endl;
void outeven
for int i ; i ; i
cout i endl;
int main
thread toutodd;
thread touteven;
tjoin;
tjoin;
choose the correct answer
The odd numbers and even numbers are mixed in an unpredictable manner.
The odd and even umbers alternate, because the threads take turns
All the odd numbers followed by all the even numbers always Because the odd thread is started first
The program crashes, because the threads conflict with each other
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
