From 8a26c08eff587c24a70e006ac0bae1e428d8543c Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 13 Apr 2026 23:19:04 +0200 Subject: [PATCH] forky.c --- AnimalProcessing/Fundamentals/forky.c | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/AnimalProcessing/Fundamentals/forky.c b/AnimalProcessing/Fundamentals/forky.c index e69de29..fb5f74c 100644 --- a/AnimalProcessing/Fundamentals/forky.c +++ b/AnimalProcessing/Fundamentals/forky.c @@ -0,0 +1,29 @@ +#include +#include +#include +#include +#include +#include + +int forky(){ + + pid_t pid = fork(); + + if (pid < 0) return -1; + else if (pid == 0){ + printf("I am the child!\n"); + exit(0); + } + else{ + printf("I am the parent!\n"); + } + return 0; +} +/* +int main(){ + + int res = forky(); + printf("%d\n", res); + +} +*/