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.
26 lines
442 B
26 lines
442 B
12 months ago
|
#include <stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
#include <stdio.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/wait.h>
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
pid_t pid;
|
||
|
int a = 6;
|
||
|
pid = fork();
|
||
|
if (pid == -1)
|
||
|
{
|
||
|
printf("Error no se puedo crear el hijo");
|
||
|
}
|
||
|
if (pid == 0)
|
||
|
{
|
||
|
a -= 5;
|
||
|
printf("El resultado del hijo es = %d\n", a);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
a += 5;
|
||
|
printf("El resultado del padre es = %d\n", a);
|
||
|
}
|
||
|
}
|