some common things in C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
434 B

#include <unistd.h>
#include <stdio.h>
int main()
{
printf("we're in main program\n");
static int i = 23;
pid_t c = fork();
if (c) {
do {
printf("we're still in main program: %d\n", i);
sleep(1);
} while (1);
}
else {
i = 42;
do {
printf("we're the child process: %d\n", i);
sleep(1);
} while (1);
}
return 0;
}