A-A+

请分析以下程序。 int main() { pid_t pid; pid = fork();

2022-08-05 20:42:12 问答库 阅读 172 次

问题详情

请分析以下程序。 int main() { pid_t pid; pid = fork(); if(pid==0) printf("I am the child process, my process ID is%dn",getpid()); else printf("I am the parent process, my process ID is%dn",getpid());} 那么,该程序正确运行后的结果是
A.I am the child process, my process ID is 3744 I am the parent process, my process ID is 3987
B.I am the child process, my process ID is 3744
C.I am the parent process, my process ID is 3987
D.不输出任何信息请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:A

考点:程序