gpt4 book ai didi

c - 为什么 fork() 的返回值在 C 中有 2 个 pid 值?

转载 作者:太空宇宙 更新时间:2023-11-04 05:05:46 25 4
gpt4 key购买 nike

<分区>

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

我是 C 新手,我对 fork() 函数的返回值结构感到困惑。

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(){
pid_t childPid;
childPid = fork();
printf("%d\n",childPid);
return EXIT_SUCCESS;
}

输出是:

28501
0

因为 pid_t 是 int 类型,childPid 怎么会有 2 个值?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com