How is it possible for fork() to return two values?

前端 未结 5 592
夕颜
夕颜 2020-12-05 15:27

Since a function in C returns only one value, all the time, how can fork(), which is also a function, return two values?

5条回答
  •  执念已碎
    2020-12-05 16:04

    The fork function returns 0 to the child process that was created and returns the childs ID to the parent process.

    The two seperate processes are each returned a single value.

    So think of it more as one return being called on each thread process.

提交回复
热议问题