Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -1,24 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
int i = 6;
|
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
pid = fork();
|
|
||||||
|
|
||||||
if (pid == -1) {
|
|
||||||
printf("Error al crear el proceso hijo");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
if (pid == 0) {
|
|
||||||
i = i - 5;
|
|
||||||
printf("Soy el proceso hijo. Valor: %d\n", i);
|
|
||||||
} else {
|
|
||||||
i = i + 5;
|
|
||||||
printf("Soy el proceso padre. Valor: %d\n", i);
|
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in new issue