![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| nawk code explanation | aoussenko | Shell Programming and Scripting | 3 | 06-04-2009 09:29 AM |
| BASH complete-filename & menu-complete together | Mithu | UNIX for Dummies Questions & Answers | 0 | 01-06-2009 03:00 PM |
| AWK deifnition and some small code explanation | amatuer_lee_3 | Shell Programming and Scripting | 0 | 05-17-2008 09:57 PM |
| need explanation | Mari.kb | UNIX and Linux Applications | 1 | 11-23-2007 10:41 AM |
| Need explanation for the syntax(code) | chandhar | Shell Programming and Scripting | 1 | 03-21-2007 04:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I have the following piece of codes. Please explain it to me in great detail how are these codes working.
1. #include <stdio.h> int main(){ int x; x=0; while (x<2 && fork()){ if (!fork()) execlp("echo","x++","x",0); x++; system("echo x+x"); } } 2. #include <stdio.h> int i; int main() { for(i=0;i<2;i++){ if(fork()) fork(); } printf ("%d\n", i); system(("echo i++"); } The attempts at a solution (include all code and scripts):[/B] Output of 1: x x+x x+x x Output of 2: 2 i++ 2 i++ 2 i++ 2 i++ 2 i++ 2 i++ 2 i++ 2 2 i++ i++ Politechnico di Torino Last edited by prakashabii; 4 Weeks Ago at 05:51 PM.. |
|
|||||
|
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.
Please review the rules, which you agreed to when you registered, if you have not already done so. More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on. If you did post homework in the main forums, please review the guidelines for posting homework and repost. Thank You. The UNIX and Linux Forums. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| code, exec, fork |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|