source: trunk/forca.c@ 26

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

Programmi 2014

File size: 333 bytes
RevLine 
[2]1#include <unistd.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5int main(void){
6 int x = fork();
7 if (x < 0){
[26]8 perror("Errore nella fork:");
9 exit(1);
[2]10 }
[26]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 }
[2]17 return 0;
18}
Note: See TracBrowser for help on using the repository browser.