[algogeeks] Explain the output
Please explain the output of following C code #includestdio.hchar *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; int main() { printf(str, 34, str, 34); return 0; } Output-- char *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; main(){ printf(str, 34, str, 34);} -- 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] Explain the output
This might Help http://en.wikipedia.org/wiki/Quine_(computing) On Thu, Jun 28, 2012 at 2:01 PM, Mad Coder imamadco...@gmail.com wrote: Please explain the output of following C code #includestdio.hchar *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; int main() { printf(str, 34, str, 34); return 0; } Output-- char *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; main(){ printf(str, 34, str, 34);} -- 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. -- best wishes!! Vaibhav -- 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] Explain the output
print statement become printf(char *str= %c%s%c; main...,34,str,34); now 34 is ascii value of double quote so first %c will get value ascii_code_of(34) and %s will get same string and last %c again get ascii_code_of(34) i.e so total string is char *str=+ asci(34)+str+ascii(34)+;main() { printf(str,34,str,34);} On Thu, Jun 28, 2012 at 2:01 PM, Mad Coder imamadco...@gmail.com wrote: Please explain the output of following C code #includestdio.hchar *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; int main() { printf(str, 34, str, 34); return 0; } Output-- char *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);}; main(){ printf(str, 34, str, 34);} -- 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. -- Thanks Regards Amritpal singh -- 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.
[algogeeks] Explain the output of this code:
#includestdio.h main() { int a[] = {0,1,2,3,4}; int *p[] = {a,a+1,a+2,a+3,a+4}; int **pp= p; printf(%d, %d, %d , *pp-a, pp-p, **pp); pp++; pp++;; ++pp; *++pp; printf(%d, %d, %d , pp-p, *pp-a, **pp); } output:0 ,0 ,0 ,4 ,4 ,4 -- 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] Explain the output of this code:
*p[] is an array of pointers pointing to the address of array a[] .. i.e p[0] pointing to a[0]..p[1] to a[1] and so on. *pp is a pointer to a pointer. It is storing the address of array of pointers p. 1. *pp gives value at pointed by p[0]. This is 'a'. So when 'a' is subtracted from it, it returns 0. 2. pp gives the address of pointer p. This is same as 'p' as it also denotes address of pointer p. Therefore 0 again. 3. **pp gives value at pointer p[0]. That is it gives value a[0] which is 0. pp++, ++p, *++p ..all these increment address of pp pointing to and not the value. So, it increments pp to +4 address of what it was previously pointing to. 4. pp-p means subtracting address of old pp and new pp, which must be four as address p+4 = address new pp. 5. (*pp -a) means subtract value where pp is pointing -'a' . As pp is incremented 4 times, it is pointing to 'a+4' . So ans is a+4-a which is 4. 6. Lastly, **pp gives the value of address stored at (*p) i.e. *(a+4) which is a[4]. Value of a[4] = 4 and so in the answer ;) On 16 June 2012 22:25, Shubham Sandeep s.shubhamsand...@gmail.com wrote: #includestdio.h main() { int a[] = {0,1,2,3,4}; int *p[] = {a,a+1,a+2,a+3,a+4}; int **pp= p; printf(%d, %d, %d , *pp-a, pp-p, **pp); pp++; pp++;; ++pp; *++pp; printf(%d, %d, %d , pp-p, *pp-a, **pp); } output:0 ,0 ,0 ,4 ,4 ,4 -- 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. -- 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] explain the output..!!
grt :) With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@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] explain the output please.....
*pass1 fail2 fail2 this will be the o/p of above code what is the problem in this? this is perfectly fine.. *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* On Sat, Oct 8, 2011 at 12:40 AM, SHIVAM AGRAWAL shivi...@gmail.com wrote: #includestdio.h main() { char c=-64; int i=-32; unsigned int u =-16; if(ci) { printf(pass1); if(cu) printf(pass 2); else printf(fail 2); } else printf(fail 1); if(iu) printf(pass2); else printf(fail2); } -- 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] explain the output please.....
@raghav garg...run the code and see the output,the output comes fail1pass2 -- 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] explain the output please.....
i have run the program in turbo c and getting same o/p as i wrote earlier.. which compiler you are using? On 10/8/11, gaurav yadav gauravyadav1...@gmail.com wrote: @raghav garg...run the code and see the output,the output comes fail1pass2 -- 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. -- Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University 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] explain the output please.....
* im using devc compiler * when if(ci) is encountered since integer has higher precedence over char ,so char is type casted to int so, (ci) is equivalent to (-64-32) which is false ,so fail1 is printed, -16 is converted to 4,294,967,295 - 16=4,294,967,280(so it is unsigned now) for(iu) integer i is converted to unsigned int so (unsigned int)i=4,294,967,264 so(iu)==(4,294,967,2644,294,967,280) is true so output is pass2 http://stackoverflow.com/questions/5563000/implicit-type-conversion-rules-in-c-operators http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_067.HTM (plz correct me if im wrong) -- 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] explain the output please.....
hey raghav my turbo c compiler gives output fail1pass2 -- 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.
[algogeeks] explain the output..!!
1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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] explain the output..!!
well #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) gives the number of elements ie sizeof whole array /sizeof first element second macro #expr - prints variable name and if value is preceded is 0 it means it s in octal formt.it is printed in decimal format by conversion hope i am clear On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote: 1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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] explain the output..!!
yeah same as sukran.. On Mon, Sep 5, 2011 at 7:55 PM, Dheeraj Sharma dheerajsharma1...@gmail.comwrote: placing 0 before the numbers..makes it in octal notation... On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote: 1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- 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] explain the output..!!
the answers are poy[i] = 1 pot[i] = 2 pot[i] = 8 pot[i] = 64 On Mon, Sep 5, 2011 at 7:55 PM, sukran dhawan sukrandha...@gmail.comwrote: well #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) gives the number of elements ie sizeof whole array /sizeof first element second macro #expr - prints variable name and if value is preceded is 0 it means it s in octal formt.it is printed in decimal format by conversion hope i am clear On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote: 1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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] explain the output..!!
is ans? 001,010 On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote: 1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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] explain the output..!!
got it ..!! thnks everyone -- 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] explain the output..!!
Answers are : arr[i] : 1 arr[i] : 8 arr[i] : 64 arr[i] : 1000 Sanju :) On Mon, Sep 5, 2011 at 7:26 AM, sukran dhawan sukrandha...@gmail.comwrote: the answers are poy[i] = 1 pot[i] = 2 pot[i] = 8 pot[i] = 64 On Mon, Sep 5, 2011 at 7:55 PM, sukran dhawan sukrandha...@gmail.comwrote: well #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) gives the number of elements ie sizeof whole array /sizeof first element second macro #expr - prints variable name and if value is preceded is 0 it means it s in octal formt.it is printed in decimal format by conversion hope i am clear On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote: 1) #include stdio.h #include stdlib.h #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) #define PrintInt(expr) printf(%s:%d\n,#expr,(expr)) int main () { /* The powers of 10 */ int pot[] = { 0001,0010,0100,1000 }; int i; for(i=0;iSIZEOF(pot);i++) PrintInt(pot[i]); return 0; } -- 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] explain the output..!!
Fourth number is not octal. Sanju :) On Mon, Sep 5, 2011 at 7:28 AM, Mohit Goel mohitgoel291...@gmail.comwrote: got it ..!! thnks everyone -- 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] explain the output..!!
@sanjay :it will not print arr[i] , it will print pot[i] On Mon, Sep 5, 2011 at 8:13 PM, rajul jain rajuljain...@gmail.com wrote: good question yaar ,from which book you read this. On Mon, Sep 5, 2011 at 7:59 PM, Sanjay Rajpal srn...@gmail.com wrote: Fourth number is not octal. Sanju :) On Mon, Sep 5, 2011 at 7:28 AM, Mohit Goel mohitgoel291...@gmail.comwrote: got it ..!! thnks everyone -- 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. -- 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] explain the output..!!
Oh , yes it will print pot[i]. Sanju :) On Mon, Sep 5, 2011 at 7:57 AM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: @sanjay :it will not print arr[i] , it will print pot[i] On Mon, Sep 5, 2011 at 8:13 PM, rajul jain rajuljain...@gmail.com wrote: good question yaar ,from which book you read this. On Mon, Sep 5, 2011 at 7:59 PM, Sanjay Rajpal srn...@gmail.com wrote: Fourth number is not octal. Sanju :) On Mon, Sep 5, 2011 at 7:28 AM, Mohit Goel mohitgoel291...@gmail.comwrote: got it ..!! thnks everyone -- 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. -- 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] Explain the output
@jitendra u got it right but parent and child are using the same text region that's why control is transferring back and forth.. try running this code and see that line numbers are repeating...because of same text region it is working like a loop... #includestdio.h int main() { int id,i; if((id=vfork())==0) { //child printf( %d in child\n,__LINE__); sleep(3); printf(%d\n,i); } else { //parent printf( %d in parent\n,__LINE__); scanf(%d,i); sleep(1); printf(%d\n,i); } return 0; } -- 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] Explain the output
changing vfork with fork gives the correct output but in case of vfork the loop behaviour is unpredictable @harit : I guess the child is simply reading the value of i from the same data area of the parent. First time it showed a garbage, after which it shows the value inputted in the parent. If i am not wrong the child uses text and data area of parent till a exec is not been called in the child. Here in the program parent and child are not doing any tweak with the text area then how can we explain the loop behaviour of the program. -- 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.