sumedh..... <su**********@gmail.comwrote:
main()
{
int i;
fork();
fork();
fork();
printf("----");
}
how many times the printf will be executed .
a.3
b. 6
c.5
d. 8
1) Wrong newsgroup: fork() isn't part of the C standard,
so discussing it's behaviour here would be off-topic.
Try e.g. comp.unix.programmers instead.
2) Did you run the program to see how often it prints?
Adding a '\n' to the output or using puts() instead
of printf() would definitely help as would including
<stdio.h(as well as a header that declares fork()).
And if you're at it also use 'int main(void) and add
a final line with 'return 0;'.
3) Neither here nor in comp.unix.programmer people are
too enthusiastic about doing other peoples homework...
Regards, Jens
--
\ Jens Thoms Toerring ___
jt@toerring.de
\__________________________
http://toerring.de