can anyone explain the reason for weird output producing by this code..
it is giving output hello many time >30 but as code's logic it should print
only 9 time
it runs correctly when i comment out statements inside else{}
thanks in advance

#include<stdio.h>
#include<stdlib.h>
int count = 0;
main()
{
    int tmp[10] , i;
    int n = 0;
    for(i=0;i<9;i++)
    {
        tmp[i]=fork();
        if(tmp[i]>0)
            break;
        else
        {
            //count++;
            printf("Hello");
            //printf(" %d -> %d \n" , tmp[i], count);
        }
    }
}

-- 
Thanks and Regards:
Rahul Kumar Patle
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
India<http://www.iitkgp.ac.in/>
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: [email protected]
[image: Linkedin]<http://www.linkedin.com/profile/view?id=106245716&trk=tab_pro>
[image: Twitter] <https://twitter.com/rahulkumarpatle>
<https://www.facebook.com/rkpatle>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to