source: trunk/forca.c

Last change on this file was 26, checked in by Mattia Monga, 10 years ago

Programmi 2014

File size: 333 bytes
Line 
1#include <unistd.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5int main(void){
6 int x = fork();
7 if (x < 0){
8 perror("Errore nella fork:");
9 exit(1);
10 }
11 if (x != 0){
12 while(1) printf("Processo padre (x == %d)\n", x);
13 }
14 else { // x == 0
15 while(1) printf("Processo figlio (x == %d)\n", x);
16 }
17 return 0;
18}
Note: See TracBrowser for help on using the repository browser.