@vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C <sachindr...@gmail.com>wrote:
> There can be some synchronisation problems with fork() right? say world > might get printed first...or maybe the letters can get jumbled too...We > cannot guarantee the order of execution unless we use semaphores. > > > On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar > <naveenkumarve...@gmail.com>wrote: > >> oh yes, >> gud one >> >> >> On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki <vishaltha...@gmail.com>wrote: >> >>> vishal@ubuntu:~/progs/c\ 12:11:53 PM >$ cat fork.c >>> #include <stdio.h> >>> #include <stdlib.h> >>> >>> int main() >>> { >>> if (fork()) { >>> printf("hello "); >>> } else { >>> printf("world\n"); >>> } >>> return 0; >>> } >>> vishal@ubuntu:~/progs/c\ 12:11:56 PM >$ gcc fork.c >>> vishal@ubuntu:~/progs/c\ 12:12:06 PM >$ ./a.out >>> hello world >>> >>> >>> On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar >>> <naveenkumarve...@gmail.com> wrote: >>> > Hi Vishal, >>> > >>> > Can you show us how it be done with fork? >>> > >>> > On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki <vishaltha...@gmail.com >>> > >>> > wrote: >>> >> >>> >> can use fork() also.. >>> >> >>> >> On Fri, Jun 3, 2011 at 11:57 AM, anand karthik >>> >> <anandkarthik....@gmail.com> wrote: >>> >> > (!printf("Hello")) >>> >> > >>> >> > On Jun 3, 2011 11:52 AM, "Arpit Mittal" <mrmittalro...@gmail.com> >>> wrote: >>> >> >> Please help me in this question. >>> >> >> >>> >> >> What's the "condition" so that the following code prints both >>> >> >> HelloWorld ! >>> >> >> >>> >> >> if "condition" >>> >> >> printf ("Hello"); >>> >> >> else >>> >> >> printf("World"); >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> -- >>> >> >> -Arpit Mittal >>> >> >> 6th Semester, >>> >> >> Indian Institute of Information Technology,Allahabad >>> >> >> Email : arpitmittal.ii...@gmail.com >>> >> >> rit2008...@iiita.ac.in >>> >> >> Contact : +91-8853049787 >>> >> >> >>> >> >> Let every man be respected as an individual and no man idolized. >>> >> >> >>> >> >> -- >>> >> >> You received this message because you are subscribed to the Google >>> >> >> Groups >>> >> >> "Algorithm Geeks" group. >>> >> >> To post to this group, send email to algogeeks@googlegroups.com. >>> >> >> To unsubscribe from this group, send email to >>> >> >> algogeeks+unsubscr...@googlegroups.com. >>> >> >> For more options, visit this group at >>> >> >> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >>> >> > >>> >> > -- >>> >> > You received this message because you are subscribed to the Google >>> >> > Groups >>> >> > "Algorithm Geeks" group. >>> >> > To post to this group, send email to algogeeks@googlegroups.com. >>> >> > To unsubscribe from this group, send email to >>> >> > algogeeks+unsubscr...@googlegroups.com. >>> >> > For more options, visit this group at >>> >> > http://groups.google.com/group/algogeeks?hl=en. >>> >> > >>> >> >>> >> -- >>> >> You received this message because you are subscribed to the Google >>> Groups >>> >> "Algorithm Geeks" group. >>> >> To post to this group, send email to algogeeks@googlegroups.com. >>> >> To unsubscribe from this group, send email to >>> >> algogeeks+unsubscr...@googlegroups.com. >>> >> For more options, visit this group at >>> >> http://groups.google.com/group/algogeeks?hl=en. >>> >> >>> > >>> > >>> > >>> > -- >>> > Cheers >>> > Naveen Kumar >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> Groups >>> > "Algorithm Geeks" group. >>> > To post to this group, send email to algogeeks@googlegroups.com. >>> > To unsubscribe from this group, send email to >>> > algogeeks+unsubscr...@googlegroups.com. >>> > For more options, visit this group at >>> > http://groups.google.com/group/algogeeks?hl=en. >>> > >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> >> >> -- >> Cheers >> Naveen Kumar >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Regards, > Shachindra A C > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With regards, Vιиodh -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.