Quantcast
Channel: c: how does function waitpid work? - Stack Overflow
Browsing index pages (2 articles)
↧

c: how does function waitpid work?

In studying CSAPP, I encounter the practice: list all of the possible output sequences for the following program:int main(){ if(Fork()==0) { printf("a"); } else { printf("b"); waitpid(-1,NULL,0); }...

View Article


Answer by jdarthenay for c: how does function waitpid work?

As Joachim Pileborg suggests, this is a flushing output problem.Just use the following:int main(){ if(Fork()==0) { printf("a\n"); } else { printf("b\n"); waitpid(-1,NULL,0); } printf("c\n");...

View Article

Browsing index pages (2 articles)


Latest Images