Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 17826

fork in nested loops

$
0
0

can someone explain How many child processes do this program create?the answer is 127, but I couldn't understand how they got it.

int create(int num){int i;for(i=0;i<num;i++)fork();}int main() {int i;fork();for(i=0;i<4;i++)create(i);return 0; }

Viewing all articles
Browse latest Browse all 17826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>