Child process copies most of the state of its parent. Meaning that it continues from the same point. That's why what is usually done is exec in a child process.
https://en.wikipedia.org/wiki/Fork%E2%80%93exec
That's not what I asked for 😅
I need to figure out how this code works:
int main() {
9 › int i;
10 › unsigned int my_pid, my_ppid, value;
11 ›
12 › /* How many processes are really generated? */
13 › for (i=0; i<NUM_FORKS; i++) {
14 › ›
15 › › value = fork();
16 › › my_pid = getpid();
17 › › my_ppid = getppid();
18 › › /* How many printed lines? */
19 › › printf("PID=%6d, PPID=%6d, i=%d, fork_value=%d\n",
20 › › my_pid, my_ppid, i, value);
21 › › /*sleep(1); */
22 › }
23 › exit(EXIT_SUCCESS);
24 }