mirror of
https://github.com/ptitSeb/box64.git
synced 2024-10-07 11:53:58 +00:00
28dc8e6751
Closes: #895
22 lines
335 B
C
22 lines
335 B
C
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <sys/wait.h>
|
|
#include <unistd.h>
|
|
|
|
void forkexample()
|
|
{
|
|
int x = 1;
|
|
|
|
if (fork() == 0)
|
|
printf("Child has x = %d\n", ++x);
|
|
else {
|
|
wait(NULL);
|
|
printf("Parent has x = %d\n", --x);
|
|
}
|
|
}
|
|
int main()
|
|
{
|
|
forkexample();
|
|
return 0;
|
|
}
|