Possible Duplicate:
Working of fork() in linux gcc
#include <stdio.h>
void main ()
{
printf ("ciao");
fork ();
}
I have some ideas about C optimization but I’m not sure. Hope you know the answer.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The code will probably print
"ciao"twice as standard output is buffered IO so the internal buffer for standard output will be replicated in the child process and both buffers flushed when each process, the parent and child, exits.It is unrelated to optimization.