單項選擇題

對以下程序運行成功時描述正確的是()。
#include < stdio.h>#include < stdlib.h>#include < unistd.h>#include < sys/types.h>main() { pid_t pid; if((pid=fork())==-1) { perror(“fork”); exit(EXIT_FAILURE); } printf(“hello\\n”); return 0;}

A.只有父進(jìn)程輸出一個hello
B.父進(jìn)程先輸出一個hello,子進(jìn)程再輸出一個hello
C.父子進(jìn)程各輸出一個hello
D.只有子進(jìn)程輸出一個hello

微信掃碼免費搜題