How many times the following code will print "techtud" ?

main(){
  p = fork();
  if(p > 0){
    fork();
    printf("techtud");
  }
  printf("techtud");
}

 

Hradesh @hradeshpatel 10 Jan 2017 11:24 pm

thks sir

priyanka gautam @priyankagautam 10 Jan 2017 11:43 pm

great sir.... thanku

Vivek Vikram Singh @vivek14 11 Jan 2017 05:43 pm
Techtud Admin @techtud 11 Jan 2017 05:48 pm

This is a nice example, Let's include it into preparation.

Shivesh Kumar Roy @shiveshroy 11 Jan 2017 10:02 pm

Thanks a lot pritam Prasun sir for such an awesome video, It basically cleared all the co-concepts related to fork() system call. I really appriciate your effort.