Re: [algogeeks] What would be the output for the following code fragment?

2012-06-07 Thread atul anand
i=300 // binary = 0001 00101100 // in case of little Endien it will be saved like this :- 0001 00101100 //suppose int = 2 bytes and char = 1 byte char *ptr = i; // take care it *char *ptr* not *int* **ptr*so what will happen *ptr will be pointing to 00101100 *++ptr // now ptr is

Re: [algogeeks] What would be the output for the following code fragment?

2012-06-07 Thread s yogeesh
A: 556 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group

Re: [algogeeks] What would be the output for the following code fragment?

2012-06-07 Thread Prem Krishna Chettri
Hahaha.. Xcellent question Dude.. People Who Know can easily explain.. So for who don't here it is.. It has nothing to do with Endianess Mr.Yogesh.. Actually the bit patter happens to be reside such that ob.ch[0] fills with all ones .. Now as we knw the sign bit concept , here compilers goes mad

Re: [algogeeks] What would be the output for the following code fragment?

2012-06-07 Thread s yogeesh
Sign bit. well i forgot abt that. Bro still nly 1 bit s taken for sign so nly 1 '1' s taken as determining sign to be negative. Still we have 7 1's in hand. Wat abt that ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] What would be the output for the following code fragment?

2012-06-06 Thread Abhishek Sharma
http://ideone.com/Zz7ET On Thu, Jun 7, 2012 at 12:27 AM, g4ur4v gauravyadav1...@gmail.com wrote: main() { int i=300; char *ptr = i; *++ptr=2; printf(%d,i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] what will be the output

2011-08-06 Thread karthik loganathan
15 times On Sat, Aug 6, 2011 at 7:20 PM, abhishek abhishek.ma...@gmail.com wrote: int x=150 for(y=x;y0;y=(x(y-1)) printf(Hi, There); How many times hi there will be printed? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] what will be the output

2011-08-06 Thread SANDEEP CHUGH
@kartik : can u explain hw it is coming? On Sat, Aug 6, 2011 at 8:33 PM, karthik loganathan karthik.algog...@gmail.com wrote: 15 times On Sat, Aug 6, 2011 at 7:20 PM, abhishek abhishek.ma...@gmail.com wrote: int x=150 for(y=x;y0;y=(x(y-1)) printf(Hi, There); How many times hi there

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread swetha rahul
2 On Sat, Jul 16, 2011 at 2:51 PM, shiv narayan narayan.shiv...@gmail.comwrote: Printf(“%d”,printf(“%d %d”,2,2) printf(“%d %d ”, 2, 2)); -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Deoki Nandan
what about this printf(\n%d,printf(%d %d,2,2)printf(%d%d ,2,2)); On Sat, Jul 16, 2011 at 3:04 PM, swetha rahul swetharahu...@gmail.comwrote: 2 On Sat, Jul 16, 2011 at 2:51 PM, shiv narayan narayan.shiv...@gmail.comwrote: Printf(“%d”,printf(“%d %d”,2,2) printf(“%d %d ”, 2, 2));

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread saurabh singh
Well if there is a space btween the two %d's dn it should be 2 2 2 23 Otherwise fine. On Sat, Jul 16, 2011 at 3:08 PM, Deoki Nandan deok...@gmail.com wrote: what about this printf(\n%d,printf(%d %d,2,2)printf(%d%d ,2,2)); On Sat, Jul 16, 2011 at 3:04 PM, swetha rahul

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Ankur Khurana
answer for first should be 2 22 23 and for second 2 222 2 correct me if i am wrong. On Sat, Jul 16, 2011 at 3:08 PM, Deoki Nandan deok...@gmail.com wrote: what about this printf(\n%d,printf(%d %d,2,2)printf(%d%d ,2,2)); On Sat, Jul 16, 2011 at 3:04 PM, swetha rahul

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread shady
@ankur that's right :) On Sat, Jul 16, 2011 at 3:25 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: answer for first should be 2 22 23 and for second 2 222 2 correct me if i am wrong. On Sat, Jul 16, 2011 at 3:08 PM, Deoki Nandan deok...@gmail.com wrote: what about this

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread varun pahwa
the ans to first should be 2 2 2 2 0. and the and to second should be. 222 2 2 please correct me if i am wrong. On Sat, Jul 16, 2011 at 4:57 PM, shady sinv...@gmail.com wrote: @ankur that's right :) On Sat, Jul 16, 2011 at 3:25 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: answer for

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread varun pahwa
please ignore my previous post. On Sat, Jul 16, 2011 at 5:38 PM, varun pahwa varunpahwa2...@gmail.comwrote: the ans to first should be 2 2 2 2 0. and the and to second should be. 222 2 2 please correct me if i am wrong. On Sat, Jul 16, 2011 at 4:57 PM, shady sinv...@gmail.com wrote:

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread varun pahwa
ignore my previous result. the ans to first should be 2 22 2 0. and the ans to second should be. 2 222 2 please correct me if i am wrong. On Sat, Jul 16, 2011 at 5:38 PM, varun pahwa varunpahwa2...@gmail.comwrote: the ans to first should be 2 2 2 2 0. and the and to second should be. 222 2

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Kamakshii Aggarwal
answer to the first should be 2 22 23 On Sat, Jul 16, 2011 at 5:44 PM, varun pahwa varunpahwa2...@gmail.comwrote: ignore my previous result. the ans to first should be 2 22 2 0. and the ans to second should be. 2 222 2 please correct me if i am wrong. On Sat, Jul 16, 2011 at 5:38 PM,

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Deoki Nandan
Give reason not answer . Answer can be found by compiler On Sun, Jul 17, 2011 at 12:38 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: answer to the first should be 2 22 23 On Sat, Jul 16, 2011 at 5:44 PM, varun pahwa varunpahwa2...@gmail.comwrote: ignore my previous result. the ans

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Kamakshii Aggarwal
printf returns no of characters printed..first of all the rightmost printf will print 2 2 .and since it is printing 3 characters(two 2's and 1 space) thereby its returning 3.same is with the other printf..now the outer most printf will print the value of(3 3) which is 3..and hence the answer. On

Re: [algogeeks] what will be the output

2011-02-05 Thread Manmeet Singh
8, 32, 96 On Sat, Feb 5, 2011 at 2:46 PM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define PrintInt(expr) printf(%s : %d\n,#expr,(expr)) *int* FiveTimes(*int* a) { *int* t; t *=* a**2 *+* a; *return* t; } *int* main() { *int*

Re: [algogeeks] what will be the output

2011-02-05 Thread Manmeet Singh
because u not thinking of operator precedence :P :P On Sat, Feb 5, 2011 at 2:52 PM, priya mehta priya.mehta...@gmail.comwrote: why is this happening? On Sat, Feb 5, 2011 at 2:51 PM, Manmeet Singh mans.aus...@gmail.comwrote: 8, 32, 96 On Sat, Feb 5, 2011 at 2:46 PM, priya mehta

Re: [algogeeks] what will be the output

2011-02-05 Thread Gajendra Dadheech
@priya u seems to be a beginner in c programming... I would suggest u to go through Dennis richie. Thanks and regards, Gajendra Dadheech On Sat, Feb 5, 2011 at 2:53 PM, Manmeet Singh mans.aus...@gmail.com wrote: because u not thinking of operator precedence :P :P On Sat, Feb 5, 2011

Re: [algogeeks] what will be the output

2011-02-05 Thread priya mehta
sure thanks:) On Sat, Feb 5, 2011 at 6:26 PM, Gajendra Dadheech gajju3...@gmail.comwrote: @priya u seems to be a beginner in c programming... I would suggest u to go through Dennis richie. Thanks and regards, Gajendra Dadheech On Sat, Feb 5, 2011 at 2:53 PM, Manmeet Singh

Re: [algogeeks] what will be the output

2011-02-05 Thread abc abc
@priya Because precedence of + operator is greater than operator . So evaluation of expression a 2 + a will be a(a+2) On Sat, Feb 5, 2011 at 6:35 PM, priya mehta priya.mehta...@gmail.comwrote: sure thanks:) On Sat, Feb 5, 2011 at 6:26 PM, Gajendra Dadheech gajju3...@gmail.comwrote:

Re: [algogeeks] what will be the output

2011-02-04 Thread rajat ahuja
12 and f(1,2) On Sat, Feb 5, 2011 at 12:46 AM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define f(a,b) a*##*b #define g(a) *#*a #define h(a) g(a) *int* main() { printf(%s\n,h(f(1,2))); printf(%s\n,g(f(1,2))); *return* 0;

Re: [algogeeks] what will be the output

2011-02-04 Thread priya mehta
thats amazing :) :) but i wanted to know the explanation dear. On Sat, Feb 5, 2011 at 12:49 AM, rajat ahuja catch.rajatah...@gmail.comwrote: 12 and f(1,2) On Sat, Feb 5, 2011 at 12:46 AM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define f(a,b) a*##*b #define

Re: [algogeeks] what will be the output

2011-02-04 Thread rajat ahuja
ohk i try to xplain , first u understand abt two macros operator # operator makes string like #define g(a) *#*a WTEVER value of a will come ,this operator wil convert that into string noe 2nd operator is concatenation one like #define f(a,b) a*##*b here a and b wil get concatenated to form

Re: [algogeeks] What would be the output of the following program..?

2010-12-14 Thread sourabh jakhar
answer will be -1 because the statement in while loop will never executed as (+(+0)!=0) this will be evaluated as false because zero is not equal to zero and i is decremented in here but decrementation is postfix uses the value first and decrement it after sequence point which is the condition