0 votes 0 votes main() { for(i=1;i<=3;i++) { printf("*"); fork(); } } how many times * will be printed ? will it be same if printf and fork statement would be interchanged? qwertyui asked Aug 20, 2016 qwertyui 563 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply qwertyui commented Aug 20, 2016 reply Follow Share i am also getting 7 but didnt run it 0 votes 0 votes qwertyui commented Aug 20, 2016 reply Follow Share and if we interchange the statements printf and fork then ? is it 11 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Here p represent printf("*") ans should be 7... papesh answered Aug 20, 2016 papesh comment Share Follow See all 3 Comments See all 3 3 Comments reply Sanket_ commented Aug 20, 2016 reply Follow Share It is printing 9 times when i run this on an online IDE.Why? 0 votes 0 votes qwertyui commented Aug 27, 2016 reply Follow Share and if we interchange printf and fork? 0 votes 0 votes Pavan Kumar Munnam commented Sep 21, 2016 reply Follow Share the child process starts executing from where the fork is called right....so how you are getting 7...it should be 3 right? 0 votes 0 votes Please log in or register to add a comment.