当前位置: 答题翼 > 问答 > 计算机类考试 > 正文
目录: 标题| 题干| 答案| 搜索| 相关
问题

对于如下C语言程序 int main() { pid_t pid; int x=1; pid = fork(); if(pid==0) printf(I am t


对于如下C语言程序 int main() { pid_t pid; int x=1; pid = fork(); if(pid==0) printf("I am the child process, x=%d ", ++x); else printf("I am the parent process, x=%d ", --x); } 在UNIX操作系统中正确编译链接后,其正确的运行结果是

A.I am the child process, x=2

B.I am the parent process, x=0

C.I am the parent process, x=2

D.I am the child process, x=0

请帮忙给出正确答案和分析,谢谢!

参考答案
您可能感兴趣的试题
  • 有如下程序段struct abc{ int a, b, c, s;};main(){ struct abc s[2]={{1,2,3},{4,5,6}}; int t;

  • 有如下程序float fun (int x int y){return(x+y);}main(){ int a=2 b=5 c=8; printf(\%3.Of f

  • 对于如下C语言程序 int main() { printf(Hello World ); fork(); fork(); printf(Hello Worl

  • 有如下程序: #include int main()

  • 有如下程序main(){int i sum; for(i=1;i

  • 有如下程序:main{ int a=2 b=-1.c=2;if(a<b)if(b<0)c=0;else c++;printf("%d\n"