Re: [algogeeks] plz help
got 45 on linux than tried with fflush(stdout) and got 9 which is correct . so I guess that both child and parent process getting the same buffer and thus resulting in more number of hello correct answer is 9 as already mentioned On Sep 21, 2011 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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.
Re: [algogeeks] plz help
Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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.
Re: [algogeeks] plz help
http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.comwrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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.
Re: [algogeeks] plz help
Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.com wrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.comwrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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.
Re: [algogeeks] plz help
@ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.com wrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.com wrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.comwrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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.
Re: [algogeeks] plz help
ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed. On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.com wrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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.
Re: [algogeeks] plz help
@ravi: thanks..!! On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.com wrote: ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed. On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.com wrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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.
Re: [algogeeks] plz help
@ ravi but compile it on http://ideone.com/nkTVN it showing 45 hello plz do look at it... On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi: thanks..!! On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.comwrote: ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed. On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.com wrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.comwrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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.
Re: [algogeeks] plz help
This is the output I am getting - result: Success time: 0smemory: 1720 kB returned value: 0 input: no output: HelloHelloHelloHelloHelloHelloHelloHelloHelloHello On Thu, Sep 22, 2011 at 1:40 AM, teja bala pawanjalsa.t...@gmail.comwrote: @ ravi but compile it on http://ideone.com/nkTVN it showing 45 hello plz do look at it... On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi: thanks..!! On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.comwrote: ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed. On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.com wrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.comwrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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
Re: [algogeeks] plz help
but in this output 10 times hello is printed..how..?? On Thu, Sep 22, 2011 at 1:52 AM, ravi maggon maggonr...@gmail.com wrote: This is the output I am getting - result: Success time: 0smemory: 1720 kB returned value: 0 input: no output: HelloHelloHelloHelloHelloHelloHelloHelloHelloHello On Thu, Sep 22, 2011 at 1:40 AM, teja bala pawanjalsa.t...@gmail.comwrote: @ ravi but compile it on http://ideone.com/nkTVN it showing 45 hello plz do look at it... On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain rashmi.jain...@gmail.comwrote: @ravi: thanks..!! On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.comwrote: ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed. On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.com wrote: @ravi can u plz explain how 10 processes are created..? shouldn't it be 9..?? On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote: Output Hello printed 10 times. Since form command spawns the process, so for every call their are two process created and since if process gets successfully created fork returns some positive no. which is the process id, so it will break the loop and finally only the 10 child processes will be left which will print Hello 10 times. I hope that I cleared your doubt. On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote: http://ideone.com/nkTVN On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar saravana@gmail.com wrote: Hello will be printed 45 times... On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.comwrote: main() { int tmp; for(i=0;i9;i++) { tmp=fork(); if(tmp0) break; printf(Hello); } } what's the output and how does this work can u give few other questions using fork... -- 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. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- 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 Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- 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
Re: [algogeeks] plz help for C output
a) 100 On Sat, Sep 10, 2011 at 12:40 AM, abhishek abhishek.ma...@gmail.com wrote: (a) #define f(g,g2) g##g2 int main() { int var12=100; printf(%d,f(var,12)); getch(); } what will be the output?? (b) main() { int i=400,j-300; printf(%d...%d); } (c) void main() { char far *farther,* farthest ; printf(%d..%d,sizeof(father),sizeof(farthest)); } -- 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. -- @ |3 # ! /\/ @ \./ -- 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.
Re: [algogeeks] plz help for C output
1. 100 2. 400...300 3. 4 .. 2 -- Parag Khanna B.tech Final Year NIT,Kurukshetra -- 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.
Re: [algogeeks] plz help for C output
2nd answer is compiler dependent ..i think so .. in gcc it gives garbage values . On Sat, Sep 10, 2011 at 3:51 AM, parag khanna khanna.para...@gmail.comwrote: 1. 100 2. 400...300 3. 4 .. 2 -- Parag Khanna B.tech Final Year NIT,Kurukshetra -- 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. -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar * Mobile +91 8056127652* bagana.bharatku...@gmail.com -- 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.
Re: [algogeeks] plz help for C output
in #definef(g,g2) g##g2 the ## operator concatenate the 2 arguments in the macro expansion. thus it becomes var12 -- Sajal Choudhary Undergraduate Student, Division of Computer Engineering, Netaji Subhas Institute of Technology, New Delhi. -- 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.
Re: [algogeeks] plz help
i think it should be 1. 5/2 paintings r made by 5/2 ppl in 5/2 days using 5/2 canvas = 1 painting is made by 1 person in 1 day using 1 canvas i.e. 1 guy cn make a painting in 1 day using a canvas. Now, the other case, to make 25 paintings using 25 canvases in 25 days. As there r 25 days total paintings required is 25, so u need just 1 guy to do that. u have here 25 canvases, bt he cn make using just 1. On Wed, Sep 7, 2011 at 8:15 AM, sush57 sushaant...@gmail.com wrote: If 5/2 artists make 5/2 paintings using 5/2 canvases in 5/2 days then how many artists r required to make 25 paintings using 25 canvases in 25 days? some sayin 25,some sayin 1...can anyone pls explain the answer for this puzzle... -- 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.
Re: [algogeeks] plz help with this
I think the code is running infinity times as there is no checking condition when to stop the calculation of max value. so before going to the max function there should be a checking till when you need to run the loop. Regards, Durga On Tue, Aug 2, 2011 at 2:30 PM, Gayathri Anandan gayathriananda...@gmail.com wrote: I didnt get any output for this pgm. I think its keep on running and got struck in the 6th line. Plz help with this. 1 #includestdio.h 2 #includeconio.h 3 int max(int a[10],int s,int e) 4 { 5 int res,res1,res2,mid=(s+e-1)/2; 6 res1=max(a,s,mid+1); 7 res2=max(a,mid+1,e); 8 res=res1res2?res1:res2; 9 return res; 10 } void main() { int a[]={2,4,1,2,3,8,7,6,9},maxval; maxval=max(a,0,9); printf(%d,maxval); getch(); } -- 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.
Re: [algogeeks] plz help with this
Well This is Certainly lacks logic behind the Coder. Please remember EVERY RECURSIVE PROGRAM Need Break for certain condition. here mid keep updating without knowing when to finish the recursion so the code never goes below line seven.. I appreciate this way of Creating LOOP although its a good CPU hogging program.. Keep Working... :P On Tue, Aug 2, 2011 at 2:30 PM, Gayathri Anandan gayathriananda...@gmail.com wrote: I didnt get any output for this pgm. I think its keep on running and got struck in the 6th line. Plz help with this. 1 #includestdio.h 2 #includeconio.h 3 int max(int a[10],int s,int e) 4 { 5 int res,res1,res2,mid=(s+e-1)/2; 6 res1=max(a,s,mid+1); 7 res2=max(a,mid+1,e); 8 res=res1res2?res1:res2; 9 return res; 10 } void main() { int a[]={2,4,1,2,3,8,7,6,9},maxval; maxval=max(a,0,9); printf(%d,maxval); getch(); } -- 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.
Re: [algogeeks] Plz help with multidimensional array
@ashish cant u make use of char *p[30] for 2 d array On Wed, Jul 7, 2010 at 9:34 AM, Ashish Goel ashg...@gmail.com wrote: char name[][10] is a auto variable on stack, so no pointers here Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jul 7, 2010 at 9:10 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote: char name[][10]={jan,feb,march}; Name is a 2-D Array of character so if you wish to store in a Pointer variable then must take a Character of Pointer of 10 characters of type char. char (*p)[10]=name; Umesh Kumar MCA D.U. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- yezhu malai vaasa venkataramana Govinda Govinda -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@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.
Re: [algogeeks] Plz help with multidimensional array
char name[][10] is a auto variable on stack, so no pointers here Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jul 7, 2010 at 9:10 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote: char name[][10]={jan,feb,march}; Name is a 2-D Array of character so if you wish to store in a Pointer variable then must take a Character of Pointer of 10 characters of type char. char (*p)[10]=name; Umesh Kumar MCA D.U. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.