563 views
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?

1 Answer

0 votes
0 votes

Here p represent printf("*")

ans should be 7...

Related questions

2 votes
2 votes
3 answers
3
Philosophical_Virus asked Dec 10, 2023
885 views
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs
3 votes
3 votes
1 answer
4
24aaaa23 asked Oct 1, 2023
777 views
Consider the following code segment :int main (void) { for (int i=2; i<=5; i++) { fork( ); }printf (“GOCLASSES”);How many times “GOCLASSES” is printed by the ab...