Re: [algogeeks] C QUESTION???
it joins the variables together ... for eg 1##2 = 12 -- *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] C QUESTION???
On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: it joins the variables together ... for eg 1##2 = 12 or a##b=ab -- *Parag Khanna B.tech Final Year NIT,Kurukshetra* -- *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] C QUESTION???
@parag thnx... btw is dere ny source dat has ny info bout it?? Regards, Payal Gupta, 3rd year, NIT-Bhopal On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: it joins the variables together ... for eg 1##2 = 12 or a##b=ab -- *Parag Khanna B.tech Final Year NIT,Kurukshetra* -- *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. -- 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] C QUESTION???
yes payal read a standard c book like dennis ritchie ... these are the best source On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote: @parag thnx... btw is dere ny source dat has ny info bout it?? Regards, Payal Gupta, 3rd year, NIT-Bhopal On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: it joins the variables together ... for eg 1##2 = 12 or a##b=ab -- *Parag Khanna B.tech Final Year NIT,Kurukshetra* -- *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. -- 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. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT 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] C QUESTION???
## concatenating operator On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: yes payal read a standard c book like dennis ritchie ... these are the best source On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote: @parag thnx... btw is dere ny source dat has ny info bout it?? Regards, Payal Gupta, 3rd year, NIT-Bhopal On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: it joins the variables together ... for eg 1##2 = 12 or a##b=ab -- *Parag Khanna B.tech Final Year NIT,Kurukshetra* -- *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. -- 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. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT 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. -- 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] C QUESTION???
@utkarsh n tejbala ...thnx..4 d info. Regards, Payal gupta, 3rd year,cse, NIT-Bhopal On Sat, Jan 7, 2012 at 9:30 AM, teja bala pawanjalsa.t...@gmail.com wrote: ## concatenating operator On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: yes payal read a standard c book like dennis ritchie ... these are the best source On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote: @parag thnx... btw is dere ny source dat has ny info bout it?? Regards, Payal Gupta, 3rd year, NIT-Bhopal On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.comwrote: On Sat, Jan 7, 2012 at 12:36 AM, parag khanna khanna.para...@gmail.com wrote: it joins the variables together ... for eg 1##2 = 12 or a##b=ab -- *Parag Khanna B.tech Final Year NIT,Kurukshetra* -- *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. -- 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. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT 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. -- 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] c question
foo(char *s){ printf(%d, sizeof(s)); // correction } in this function foo s is a pointer so it print size of pointer which is 4 . On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh love.for.programm...@gmail.com wrote: In any C program, int main(){ char a[100]; foo(a); printf(%d, sizeof(a)); } foo(char *s){ printf(%d, sizeof(a)); } In main sizeof a is 100, in foo it is 4. why?? -- 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] c question
array is always given a special treatment...its nt a constant ptrits an array means 100 bytes r resrvd for it for this i think u mst go thru pointers in c and ritchi books. On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh love.for.programm...@gmail.com wrote: foo(char []s){ printf(%d, sizeof(s)); } even now it prints 4. My point is s pointer in foo and a is also a constant pointer in main. (a is passed to foo) However, in main a is treated as an rvalue and in s the same pointer is an lvalue. why?? Someone plz reply. It's urgent -- 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 Himanshu Kansal Msc Comp. sc. (University of 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] c question
char *p,char [] are both same they both have size 4 On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal himanshukansal...@gmail.com wrote: array is always given a special treatment...its nt a constant ptrits an array means 100 bytes r resrvd for it for this i think u mst go thru pointers in c and ritchi books. On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh love.for.programm...@gmail.com wrote: foo(char []s){ printf(%d, sizeof(s)); } even now it prints 4. My point is s pointer in foo and a is also a constant pointer in main. (a is passed to foo) However, in main a is treated as an rvalue and in s the same pointer is an lvalue. why?? Someone plz reply. It's urgent -- 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 Himanshu Kansal Msc Comp. sc. (University of 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. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT 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] c question
As declaration of a[100] is defined in main function so main function print 100 , but foo() only know a pointer to a char data type that is why it print 4 in function foo() correct me if i am wrong! On Sat, Sep 3, 2011 at 6:52 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: char *p,char [] are both same they both have size 4 On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal himanshukansal...@gmail.com wrote: array is always given a special treatment...its nt a constant ptrits an array means 100 bytes r resrvd for it for this i think u mst go thru pointers in c and ritchi books. On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh love.for.programm...@gmail.com wrote: foo(char []s){ printf(%d, sizeof(s)); } even now it prints 4. My point is s pointer in foo and a is also a constant pointer in main. (a is passed to foo) However, in main a is treated as an rvalue and in s the same pointer is an lvalue. why?? Someone plz reply. It's urgent -- 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 Himanshu Kansal Msc Comp. sc. (University of 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. -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT 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. -- 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] c question
See, a is defined in main() therefore its scope is limited to main(). It is stored probably in main()'s stack When you pass it to a function as a pointer. You don't make a copy of 'a' onto the function's stack. The only way you can view, manipulate it is using a pointer, and that pointer is your only reference to the value that is stored somewhere else. That's why. -- 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] c question
ok i got this point. Plz answer this, s is a pointer in foo and a is also a constant pointer in main. (a is passed to foo) However, in main a is treated as an rvalue and in s the same pointer is an lvalue. why?? -- 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] c question
Isn't it obvious now? -- 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] c question
when u pass array as an argument to a function only the starting address is passed .so sizeof(a) is address of pointer ! On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh love.for.programm...@gmail.com wrote: In any C program, int main(){ char a[100]; foo(a); printf(%d, sizeof(a)); } foo(char *s){ printf(%d, sizeof(a)); } In main sizeof a is 100, in foo it is 4. why?? -- 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] C-question
Thank,,,Now got it. On Tue, Aug 23, 2011 at 11:22 AM, nagarajan naga4...@gmail.com wrote: Hi Vijay, i = 10 10 5 = 0 5 = 1 On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar vijaykhand...@gmail.comwrote: main() { int x=10,y=10,z=5; int i=xyz; pf(\n%d,i); } o/p is 1 .pls any1 explain me hw is it printing? -- 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. -- Nagarajan S -- 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] C-question
Hi Vijay, i = 10 10 5 = 0 5 = 1 On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar vijaykhand...@gmail.comwrote: main() { int x=10,y=10,z=5; int i=xyz; pf(\n%d,i); } o/p is 1 .pls any1 explain me hw is it printing? -- 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. -- Nagarajan S -- 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] C-Question
Can you explain me shortly how 5.375 is converted into normalised form...How to find mantissa and Exponent in this case? Plz Explain meVijay On Sun, Aug 21, 2011 at 1:25 PM, Rahul Tiwari rahultiwari6...@gmail.comwrote: On Sun, Aug 21, 2011 at 11:11 AM, Rahul Tiwari rahultiwari6...@gmail.comwrote: @vijay u take normalised form of 5.375 wrong . actual normalised form of 5.375 = 0100 1010 1100 On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar vijaykhand...@gmail.comwrote: but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100 ONLY in this way..Vijay Khandar... On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro dip10c...@gmail.comwrote: float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p 00 00 AC 40 ^^ it is in little endian format. i.e the data bytes are stored in memory is reverse format. On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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 -- 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. -- Rahul Tiwari aka DONE B Tech Final Year Information Technology Motilal Nehru National Institute of Technology , Allahabad 9838339030 -- Rahul Tiwari aka DONE B Tech Final Year Information Technology Motilal Nehru National Institute of Technology , Allahabad 9838339030 -- 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] c question what is output?
FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote: #includestdio.h #define FUNC1(i) (i*(i-1)) #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) main() { int i=8; printf(\n%d,FUNC2(i)); } -- 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 SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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] c question what is output?
+1 to sagar Sanju :) On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.com wrote: FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: #includestdio.h #define FUNC1(i) (i*(i-1)) #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) main() { int i=8; printf(\n%d,FUNC2(i)); } -- 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 SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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. -- 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] c question what is output?
doesn it work like below ? func2(8)= 8 * func1(7) func1(7)= 7*6 so i=8*7*6??? On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote: +1 to sagar Sanju :) On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote: FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: #includestdio.h #define FUNC1(i) (i*(i-1)) #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) main() { int i=8; printf(\n%d,FUNC2(i)); } -- 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 SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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. -- 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, Ayswarya S -- 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] c question what is output?
Nopes, its a funda of PRE-PROCESSOR directives. Look before the object code is generated for the program, all the occurences of the MACROs are replaced with their expansions as such as in the definition. So what u r doing is completely wrong. For more info on MACROs, refer any text book of C. Sanju :) On Sun, Aug 21, 2011 at 4:05 AM, Ayswarya Srinivasan krsayswa...@gmail.comwrote: doesn it work like below ? func2(8)= 8 * func1(7) func1(7)= 7*6 so i=8*7*6??? On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote: +1 to sagar Sanju :) On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote: FUNC2(i) = i==0?i*(i-1*(i-1-1)) 8==0?1:8*(8-1*(8-1-1)) 8==0?1:8*(8-6) 8==0?1:8*2 8==0?1:16 hence it will return 16 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: #includestdio.h #define FUNC1(i) (i*(i-1)) #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) main() { int i=8; printf(\n%d,FUNC2(i)); } -- 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 SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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. -- 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, Ayswarya S -- 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] C-Question
check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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] C-Question
Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.comwrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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] C-Question
Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.comwrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- 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] C-Question
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote: Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.com wrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- With regards Puneet Chawla Computer Engineering Student 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] C-Question
I was thinking the same ..byte by byte from R to L thank u very muchNow i have got it..On Sun, Aug 21, 2011 at 6:01 PM, Puneet Chawla puneetchawla...@gmail.com wrote: forgot to mention last byte 00 then 2nd last 00 and so on AC then 40 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote: Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.com wrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- With regards Puneet Chawla Computer Engineering Student 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. -- 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] C-Question
Thanks puneet ... On Sun, Aug 21, 2011 at 6:01 PM, Puneet Chawla puneetchawla...@gmail.comwrote: forgot to mention last byte 00 then 2nd last 00 and so on AC then 40 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote: Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.com wrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- With regards Puneet Chawla Computer Engineering Student 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. -- 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] c question
thnx:) On Sun, Aug 21, 2011 at 9:26 AM, Sanjay Rajpal srn...@gmail.com wrote: See you are considering one bit of bit1, and printing it as signed integer. So what i think is that '1' bit will be treated as while treating it as Signed Integer, and this is the binary representation of -1. Hence the result. If you write it as unsigned int bit1:1, the result is 122. So my argument is correct. Try this and let me know. Correct me If m wrong. Sanju :) On Sat, Aug 20, 2011 at 8:44 PM, sukran dhawan sukrandha...@gmail.comwrote: only one bit is reserved for it.so the binary representation is 1.since only one bit is present, that bit becomes sign nit and hence -1 On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh saurab...@gmail.comwrote: Read bit field On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com wrote: #includestdio.h main() { struct value { int bit1:1; int bit2:4; int bit3:4; }bit={1,2,2}; printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3); } output is -1,2,2; can anybody tell me the reason that y it is giving -1 ?? -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT 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. -- 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] c question
it can also be understood as, range of signed integers are -2^(no. of bits-1) to 2^(no. of bits-1)-1 so here is only one bit so its range will be from -1 to 0. that's why storing 1 means -1. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Xwqu8zxk3RkJ. 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] C-Question
float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p 00 00 AC 40 ^^ it is in little endian format. i.e the data bytes are stored in memory is reverse format. On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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 -- 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] C-Question
+1 to Dipankar Sanju :) On Sat, Aug 20, 2011 at 12:01 AM, Dipankar Patro dip10c...@gmail.comwrote: float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p 00 00 AC 40 ^^ it is in little endian format. i.e the data bytes are stored in memory is reverse format. On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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 -- 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] C-Question
5.375 in normalised form is - 0100 1010 1100 As we type cast into char so in little endian system it take 8 bits from last and store into p[0] , then it take next 8 bits store it into p[1] so on ... In printf statement here X is specifier for float so it print hexadecimal equivalent of binary number. On Sat, Aug 20, 2011 at 11:21 AM, Vijay Khandar vijaykhand...@gmail.comwrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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] C question
See if a number is power of 2, then only one bit in the number will be set. e.g. for 16, 0001 assuming 8-bit representation. then when you subtract 1 from this number, the bits to the right of the previously set bit will be set, and the set bit will become unset. e.g. 16 will become 15, . Take bitwise and, th result will be 0 if it is a power of 2. taking Logical NOT will give 1. Hence the result. Sanju :) On Sat, Aug 20, 2011 at 3:45 AM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: explain it plz On Sat, Aug 20, 2011 at 4:09 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: got it ...thanks On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote: if(!(x x-1)) printf(No. is power of 2); Sanju :) On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav algowithabhis...@gmail.com wrote: Give a one-line C expression to test whether a number is a power of 2. -- 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] C question
@sandeep number which is a power of 2 only one bit will be set. number -1 : all the bits except the one which was set at num with be 1 so num num-1 will be 0 coz of bitwise and On Sat, Aug 20, 2011 at 4:15 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: explain it plz On Sat, Aug 20, 2011 at 4:09 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: got it ...thanks On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote: if(!(x x-1)) printf(No. is power of 2); Sanju :) On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav algowithabhis...@gmail.com wrote: Give a one-line C expression to test whether a number is a power of 2. -- 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] C question
@sukran explain plz On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan sukrandha...@gmail.comwrote: one more condition is required if(num != 0 !( num (num-1)) On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote: if(!(x x-1)) printf(No. is power of 2); Sanju :) On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav algowithabhis...@gmail.com wrote: Give a one-line C expression to test whether a number is a power of 2. -- 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] C question
@sandeep number which is a power of 2 only one bit will be set. number -1 : all the bits except the one which was set at num with be 1 so num num-1 will be 0 coz of bitwise and On Sat, Aug 20, 2011 at 4:18 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: @sukran explain plz On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan sukrandha...@gmail.comwrote: one more condition is required if(num != 0 !( num (num-1)) On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote: if(!(x x-1)) printf(No. is power of 2); Sanju :) On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav algowithabhis...@gmail.com wrote: Give a one-line C expression to test whether a number is a power of 2. -- 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] C question
okey thnks @sukran.. :) On Sat, Aug 20, 2011 at 4:20 PM, sukran dhawan sukrandha...@gmail.comwrote: @sandeep number which is a power of 2 only one bit will be set. number -1 : all the bits except the one which was set at num with be 1 so num num-1 will be 0 coz of bitwise and On Sat, Aug 20, 2011 at 4:18 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: @sukran explain plz On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan sukrandha...@gmail.comwrote: one more condition is required if(num != 0 !( num (num-1)) On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal srn...@gmail.com wrote: if(!(x x-1)) printf(No. is power of 2); Sanju :) On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav algowithabhis...@gmail.com wrote: Give a one-line C expression to test whether a number is a power of 2. -- 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. -- 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] c question
Read bit field On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com wrote: #includestdio.h main() { struct value { int bit1:1; int bit2:4; int bit3:4; }bit={1,2,2}; printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3); } output is -1,2,2; can anybody tell me the reason that y it is giving -1 ?? -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT 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] c question
only one bit is reserved for it.so the binary representation is 1.since only one bit is present, that bit becomes sign nit and hence -1 On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh saurab...@gmail.com wrote: Read bit field On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com wrote: #includestdio.h main() { struct value { int bit1:1; int bit2:4; int bit3:4; }bit={1,2,2}; printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3); } output is -1,2,2; can anybody tell me the reason that y it is giving -1 ?? -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT 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. -- 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] c question
See you are considering one bit of bit1, and printing it as signed integer. So what i think is that '1' bit will be treated as while treating it as Signed Integer, and this is the binary representation of -1. Hence the result. If you write it as unsigned int bit1:1, the result is 122. So my argument is correct. Try this and let me know. Correct me If m wrong. Sanju :) On Sat, Aug 20, 2011 at 8:44 PM, sukran dhawan sukrandha...@gmail.comwrote: only one bit is reserved for it.so the binary representation is 1.since only one bit is present, that bit becomes sign nit and hence -1 On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh saurab...@gmail.comwrote: Read bit field On Sun, Aug 21, 2011 at 2:44 AM, Nitin coolguyinat...@gmail.com wrote: #includestdio.h main() { struct value { int bit1:1; int bit2:4; int bit3:4; }bit={1,2,2}; printf(%d%d%d,bit.bit1,bit.bit2,bit.bit3); } output is -1,2,2; can anybody tell me the reason that y it is giving -1 ?? -- 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. -- Saurabh Singh B.Tech (Computer Science) MNNIT 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. -- 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] C-Question
but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100 ONLY in this way..Vijay Khandar... On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro dip10c...@gmail.comwrote: float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p 00 00 AC 40 ^^ it is in little endian format. i.e the data bytes are stored in memory is reverse format. On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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 -- 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] C-Question
@vijay u take normalised form of 5.375 wrong . actual normalised form of 5.375 = 0100 1000 1010 1100 On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar vijaykhand...@gmail.comwrote: but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100 ONLY in this way..Vijay Khandar... On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro dip10c...@gmail.comwrote: float is 4 bytes. so a=3.75 will be stored in 4 bytes in memory. the moment you have a pointer referring to the same memory location but type cast to (char *), the pointer will refer to character i.e. 1 byte. ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75 now finally the o/p 00 00 AC 40 ^^ it is in little endian format. i.e the data bytes are stored in memory is reverse format. On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote: If the binary equivalent of 5.375 in normalised form is - 0100 1010 1100 what is the o/p of following code- main() { float a=5.375; char *p; int i; p=(char *)a; for(i=0;i=3;i++) printf(%02X,(unsigned char)p[i]); } O/P= 00 00 AC 40 Plz, Plz anyone explain me in detail, how this o/p is coming? Vijay.. -- 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 -- 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. -- Rahul Tiwari aka DONE B Tech Final Year Information Technology Motilal Nehru National Institute of Technology , Allahabad 9838339030 -- 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] c question
The problem is because of \n in the prnintf statement. When new line is there in first printf it flushes the standard buffer and so in child the output of printf is not present in second program. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 13, 2011 at 9:29 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: aren't two programs same ? and scheduling of two forked and parent process is prcoessor dependent. You dont have a say in it. On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy moorthyth...@gmail.comwrote: #includestdio.h #includeunistd.h int main() { int return_value; printf(forking process); fork(); printf(hello\n); return 0; } in the above program the output is forking processhello forking processhello but in the below prog includestdio.h #includeunistd.h int main() { int return_value; printf(forking process\n); fork(); printf(hello\n); return 0; } the output is forking process hello hello why its so ?? -- by $THANU$ -- 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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology 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. -- 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] c question
aren't two programs same ? and scheduling of two forked and parent process is prcoessor dependent. You dont have a say in it. On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy moorthyth...@gmail.comwrote: #includestdio.h #includeunistd.h int main() { int return_value; printf(forking process); fork(); printf(hello\n); return 0; } in the above program the output is forking processhello forking processhello but in the below prog includestdio.h #includeunistd.h int main() { int return_value; printf(forking process\n); fork(); printf(hello\n); return 0; } the output is forking process hello hello why its so ?? -- by $THANU$ -- 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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology 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] c question!
hmm ya am sorry abt that..what abt the first part i mentioned...how is it (nodeptr*)malloc according to you (which is creating a pointer to a pointer type nodeptr )rather than just nodeptr which is a pointer to structure? how to get size of structure as such in this case? On Thu, Aug 11, 2011 at 7:04 AM, siddharth srivastava akssps...@gmail.comwrote: (sizeof(struct)); ?? That doesn't makes sense. Size of struct is what ?? you need the size of your structure with the variables you have declared in it. cos malloc returns pointer to memory block and nodeptr itself is a pointer and you have used nodeptr* further? On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava akssps...@gmail.com wrote: @sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem Pointer points to a location in memory. You can't use h without making h to reference to some area in memory. And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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 Siddharth Srivastava -- 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. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- 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 Siddharth Srivastava -- 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. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- 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] c question!
@siddarth: should not the statement you mentioned above as nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*)); be nodeptr h =(struct*)malloc(sizeof(struct)); ?? cos malloc returns pointer to memory block and nodeptr itself is a pointer and you have used nodeptr* further? On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava akssps...@gmail.comwrote: @sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem Pointer points to a location in memory. You can't use h without making h to reference to some area in memory. And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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 Siddharth Srivastava -- 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. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- 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] C question
@ram got it. tanx :) -- 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] c question!
(sizeof(struct)); ?? That doesn't makes sense. Size of struct is what ?? you need the size of your structure with the variables you have declared in it. cos malloc returns pointer to memory block and nodeptr itself is a pointer and you have used nodeptr* further? On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava akssps...@gmail.comwrote: @sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem Pointer points to a location in memory. You can't use h without making h to reference to some area in memory. And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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 Siddharth Srivastava -- 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. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- 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 Siddharth Srivastava -- 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] c question!
it will give error in line 3 because nodeptr is undefined till that point.. On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com wrote: -- 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] c question!
yep it will !! any ways nodeptr is another name for pointer to the same structure so you dont need to write structname *nodeptr you can simply write nodeptr *p(say) to declare pointer to the structure On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote: it will give error in line 3 because nodeptr is undefined till that point.. On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com wrote: -- 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] c question!
#includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);} this gives an error. Please explain the concept behind this. -- 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] c question!
is it giving an error at *nodeptr declaration? On Tue, Aug 9, 2011 at 8:26 PM, programming love love.for.programm...@gmail.com wrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);} this gives an error. Please explain the concept behind this. -- 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] c question!
Hi On 9 August 2011 20:26, programming love love.for.programm...@gmail.comwrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);} this gives an error. Please explain the concept behind this. You have used typedef incorrectly -- 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 Siddharth Srivastava -- 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] c question!
dont use *h just use h On Tue, Aug 9, 2011 at 8:31 PM, siddharth srivastava akssps...@gmail.comwrote: Hi On 9 August 2011 20:26, programming love love.for.programm...@gmail.comwrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);} this gives an error. Please explain the concept behind this. You have used typedef incorrectly -- 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 Siddharth Srivastava -- 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] c question!
this gives an error. Please explain the concept behind this. try using something like this: #includestdio.h #includemalloc.h typedef struct { char * a; }* nodeptr; main(){ nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*)); h-a=programming; printf(hi %s\n, h-a); } though typedef struct{ char *a; } nodeptr; would be better in terms of readability and understanding. You have used typedef incorrectly -- 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 Siddharth Srivastava -- 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 Siddharth Srivastava -- 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] c question!
a new pointer type that can store the address of such structure for example nodeptr p; will declare a pointer to that struct but it is useless for me. On Aug 9, 2011 8:19 PM, programming love love.for.programm...@gmail.com wrote: @rohith, what if that statement is removed. Now, what will nodeptr stand for? On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote: it will give error in line 3 because nodeptr is undefined till that point.. On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com wrote: -- 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] c question!
#includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr h;h-a=programming;printf(hi %s\n, h-a);} @sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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] c question!
when you declared h it contains garbage address . h-a is meaningless . read pointers chapter from K nd R for full details about pointers in C . On Aug 9, 2011 9:11 PM, programming love love.for.programm...@gmail.com wrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr h;h-a=programming;printf(hi %s\n, h-a);} @sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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] c question!
@sidharth: thanks a lot for correcting me :) @aditya : no. there was some mistake; in the code i pasted above it's giving segmentation fault. Is it cause i'm initializing h without using malloc?? Please throw light on this problem Pointer points to a location in memory. You can't use h without making h to reference to some area in memory. And in the following code char *s; scanf(%s, s); why isn't it possible to store a string in s?? Please explain both concepts. -- 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 Siddharth Srivastava -- 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] C question
Correct me if i'm wrong. I think it's cos at a time it'll fetch the amount of bytes = to it's register's size. If a 32-bit machine is being used, answer will contain 4 bytes ff81 16-bit machine - ff81 -- 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] C question
signed char 129 = -127 127 = 0111 -127 = 1000 0001 (2's compliment form) = ff81 (hex) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/0Y7Ev0aJuLgJ. 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] C question.. sizeof operator
output would be 10 size of just calculate the type of the expression not the value Best Wishes Sachin Sharma -- 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] C question.. sizeof operator
i=10 -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- 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] C question.. sizeof operator
sizeof is not a function. The inside content in sizeof() cannot be compiled during the compiling time, It will be replaced with the type. For example, compiler will replace the code as j = 4; So ++i does not execute. On Aug 3, 2011, at 6:12 PM, brijesh wrote: main() { int i,j; i=10; j=sizeof(++i); printf(%d,i); } please give the output with explanation! -- 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. (Steven Qin) founder in Rfanti.com(烦题网) Mobile: 18621588738 Office: +86-21-60832295 Rfanti / www.rfanti.com 单位: 上海阿拉丁电子商务有限责任公司 地址: 上海市宝山区淞桥东路111号联合滨江大厦1811 有问题,找烦题 -- 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] C question.. increment decrement operator..
Its compiler dependent. Acc. to the C standard an object's stored value can be modified only once in an expression. -- 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] C question.. increment decrement operator..
As we know: In an expression, if pre n post occur simultaneously, pre inc the value then n there only n post executes it after that expression...and expression evaluates right to left... Also, the value of a variable in an expression can be modified multifold times...there is no restriction on dat... Here in this code: Print statement No.: 1. i++*i++ is equivalent to: output i*i(7*7) followed by i=i+1; i=i+1; prior to 2nd printf statement..that makes i=9 2. i++*++i expn. evaluates right to left: i inc. by one due to pre.. i is now 10 . output i*i(10*10) i=i+1 (due to post inc., it inc. the value after the output) i is now 11 3. ++i*i++ right to left evaluation, but post inc. increases value only after output.. coming to ++i in the expn., i inc. to 12 output: 12*12 i=i+1(due to postinc.) i is now 13 4. ++i*++i both pre inc operators, order of evaluation doesnt ,matter: i=i+1 i=i+1 output: 15*15 i finishes at 15 Hence the output: 49 100 144 225 I think i made it clear.. Feel free to point any loopholes.. Thanks. On 8/3/11, ankit sambyal ankitsamb...@gmail.com wrote: Its compiler dependent. Acc. to the C standard an object's stored value can be modified only once in an expression. -- 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] C question.. sizeof operator
output ll be 10..sizeof operation just find the size of the variable's datatype..no changes for the variable inside the operation.. -- 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] C-Question
Actually incrementing and decrementing whether pre and post will not affect in this case because (increment and decrement ) will be done before checking the condition. As in for loop three sequential steps are . 1. Initialization 2. Checking condition 3. Increment or decrement On Tue, Aug 2, 2011 at 2:56 PM, Vijay Khandar vijaykhand...@gmail.com wrote: for(i=1,j=10;i6;++i,--j) pf(%d %d,i,j); and for(i=1,j=10;i6;i++,j--) pf(%d %d,i,j); why this both giving same o/p, since one is pre and other is postplz explain me -- 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. -- From: Naveen Shukla IIIT Allahabad B.Tech IT 2nd year Mob No: 07860896972 E-mail rit2009...@iiita.ac.in naveenshuklasweetdrea...@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] C-Question
coz we do in for loop 1st initialization thn condition thn increment so in 1st for loop it will print the value thn increment the i's value so itll behave like a i++ dats y no diffrence in the o/p :):) -- 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] C-Question
Thanks Naveen.. On Tue, Aug 2, 2011 at 3:13 PM, naveen shukla naveenshuklasweetdrea...@gmail.com wrote: Actually incrementing and decrementing whether pre and post will not affect in this case because (increment and decrement ) will be done before checking the condition. As in for loop three sequential steps are . 1. Initialization 2. Checking condition 3. Increment or decrement On Tue, Aug 2, 2011 at 2:56 PM, Vijay Khandar vijaykhand...@gmail.com wrote: for(i=1,j=10;i6;++i,--j) pf(%d %d,i,j); and for(i=1,j=10;i6;i++,j--) pf(%d %d,i,j); why this both giving same o/p, since one is pre and other is postplz explain me -- 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. -- From: Naveen Shukla IIIT Allahabad B.Tech IT 2nd year Mob No: 07860896972 E-mail rit2009...@iiita.ac.in naveenshuklasweetdrea...@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. -- 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] C-Question
Thanks Jagrati On Tue, Aug 2, 2011 at 3:19 PM, jagrati verma jagrativermamn...@gmail.comwrote: coz we do in for loop 1st initialization thn condition thn increment so in 1st for loop it will print the value thn increment the i's value so itll behave like a i++ dats y no diffrence in the o/p :):) -- 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] C-Question
Becaus eof Bitwise and 0110 (6) 0001 0010 (10) 0010 (2) So 00 0 01 0 10 0 11 1 On Mon, Aug 1, 2011 at 3:31 PM, Vijay Khandar vijaykhand...@gmail.comwrote: main() { int a=6,b=10,x; x=ab; printf(%d,x); } O/P=2 Plz any one explain me ,how its come -- 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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] C-question
Now got it Thanks... On Wed, Jul 27, 2011 at 11:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote: The output is 10101101 consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) - f(2) - f(1) 1 0 110 1 01 Hope you get the recursion there . On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n) { if(n=1) { printf( %d,n); } else { f(n/2); printf( %d,n%2); } } void main() { clrscr(); f(173); getch(); } o/p-1 0 1 0 1 1 0 1 but i m getting 1 0 1 1 0 1 0 1 plz explain me... -- 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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] C-question
I am getting the proper output :) 1 0 1 0 1 1 0 1 *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n) { if(n=1) { printf( %d,n); } else { f(n/2); printf( %d,n%2); } } void main() { clrscr(); f(173); getch(); } o/p-1 0 1 0 1 1 0 1 but i m getting 1 0 1 1 0 1 0 1 plz explain me... -- 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] C-question
The output is 10101101 consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) - f(2) - f(1) 1 0 110 1 01 Hope you get the recursion there . On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n) { if(n=1) { printf( %d,n); } else { f(n/2); printf( %d,n%2); } } void main() { clrscr(); f(173); getch(); } o/p-1 0 1 0 1 1 0 1 but i m getting 1 0 1 1 0 1 0 1 plz explain me... -- 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 Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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] C-question
@vijay put return n int function f(), you will get expected out put. as like this... #includestdio.h #includeconio.h int f(int n) { if(n=1) { printf( %d,n); return n; } else { f(n/2); printf( %d,n%2); return n; } } void main() { clrscr(); f(173); 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.
Re: [algogeeks] C question
in the frst pass its passed as f(20,1) n%2 =0 so else condition will be returned ie. f(10,2) -1 now in f(10,2) agn else and return will be f(5,4)-2 now n%2=1 so return will be f(2,8) +4 f(2,8) will be agn else and return will be f(1,16)-8 now fr f(1,16) return will be f(0,32) +16 and now at last return will be 0 so the value will be -1-2+4-8+16=9 On Mon, Jul 25, 2011 at 9:18 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n,int k) { if (n==0) return 0; else if(n%2) return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } int main() { clrscr(); printf(\n %d,f(20,1)); getch(); } O/p is 9.Plz explai me how it is come Vijay. -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- 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] C question
f(20,1)-f(10,2)-1- f(5,4)-2 -f(2,8) +4 - f(1,16)-8 - f(0,32) +16-return 0 10-1=9 12-2=10 - 8+4=12 16-8=8 0+16 - - *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Mon, Jul 25, 2011 at 8:48 AM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n,int k) { if (n==0) return 0; else if(n%2) return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } int main() { clrscr(); printf(\n %d,f(20,1)); 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.
Re: [algogeeks] C question
Thanks MuthurajI got it.. On Mon, Jul 25, 2011 at 9:42 PM, sameer.mut...@gmail.com sameer.mut...@gmail.com wrote: f(20,1)-f(10,2)-1- f(5,4)-2 -f(2,8) +4 - f(1,16)-8 - f(0,32) +16-return 0 10-1=9 12-2=10 - 8+4=12 16-8=8 0+16 - - *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Mon, Jul 25, 2011 at 8:48 AM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n,int k) { if (n==0) return 0; else if(n%2) return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } int main() { clrscr(); printf(\n %d,f(20,1)); 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] C question
Thanks Aditi..I got it... On Mon, Jul 25, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: in the frst pass its passed as f(20,1) n%2 =0 so else condition will be returned ie. f(10,2) -1 now in f(10,2) agn else and return will be f(5,4)-2 now n%2=1 so return will be f(2,8) +4 f(2,8) will be agn else and return will be f(1,16)-8 now fr f(1,16) return will be f(0,32) +16 and now at last return will be 0 so the value will be -1-2+4-8+16=9 On Mon, Jul 25, 2011 at 9:18 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n,int k) { if (n==0) return 0; else if(n%2) return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } int main() { clrscr(); printf(\n %d,f(20,1)); getch(); } O/p is 9.Plz explai me how it is come Vijay. -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- 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] C Question
To clear pointer basics and dwell deep into the subject please WORK OUT THESE video series ALONGwith The assignments . . http://see.stanford.edu/see/lecturelist.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee On 6/8/11, Vishal Thanki vishaltha...@gmail.com wrote: Following declaration makes the x as a volatile pointer to an integer. int *volatile x; But what does following means? int **volatile x; ~Vishal -- 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. -- Rahul -- 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] C Question
anything that is declared volatilecompiler dont apply its optimization on that storage i.e it dont remove the redundant memory accesses in case of a normal volatile variable ,its value is checked everytime it is used in the program compiler dont make any assumptions similarly in case of volatile pointer ,its address is checked everytime it is derefrenced On Thu, Jun 9, 2011 at 10:36 PM, shashankreddy509 shashankreddy...@gmail.com wrote: @Aditya:- can u give a brief intro of volatile pointer. Thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/SJkBkvK-MqAJ. 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 Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, 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] C Question
@Aditya; Thanks.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/UO6vAXBXhXEJ. 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] C Question
a volatile pointer to a volatile pointer to integer int *volatile *p; a pointer to a volatile pointer to interger On Wed, Jun 8, 2011 at 11:28 AM, Vishal Thanki vishaltha...@gmail.comwrote: Following declaration makes the x as a volatile pointer to an integer. int *volatile x; But what does following means? int **volatile x; ~Vishal -- 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 Aditya Kumar B-tech 3rd year Computer Science Engg. MNNIT, 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] C Question
@Aditya:- can u give a brief intro of volatile pointer. Thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/SJkBkvK-MqAJ. 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.