13. 请分析以下程序。 int main() { pid_t pid; pid=fork; if(pid==0) printf("I am the child process, my process ID is% d\n", getpid()); else printf("I am the parent process, my process ID js% d\n", getpid()); } 该程序正确运行后的结果是______。
A.I am the child process,my process ID is3744 I am the parent process,my process ID is3987
B.I am the child process,my process ID is3744
C.I am the parent process,my process ID is3987
D.不输出任何信息
A B C D
A
[解析] 计算机程序设计中的fork()函数返回值:若成功调用一次则返回两个值,子进程返回0,父进程返回子进程标记;否则,出错返回-1。假设程序正确运行并创建子进程成功,那么,子进程为0,父进程为进程号,所以输出I am the child process, my process ID is3744 I am the parent process, my process ID is3987。