[algogeeks] what will be the output

2011-02-05 Thread priya mehta
#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* a *=* 1, b *=* 2,c *=* 3; PrintInt(FiveTimes(a)); PrintInt(FiveTimes(b));

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

[algogeeks]

2011-02-05 Thread radha krishnan
guess the output main() { int x=(1,024),y; y=1,024; printf(%d %d,x,y); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks]

2011-02-05 Thread ankit sablok
x is 20 for sure and y i m guessing to be 1 comma operator and 0 used for octal constnts On Sat, Feb 5, 2011 at 3:01 PM, radha krishnan radhakrishnance...@gmail.com wrote: guess the output main() { int x=(1,024),y; y=1,024; printf(%d %d,x,y); } -- You received this

Re: [algogeeks]

2011-02-05 Thread vaibhav agrawal
@ankit: how x is 20? On Sat, Feb 5, 2011 at 4:46 PM, ankit sablok ankit4...@gmail.com wrote: x is 20 for sure and y i m guessing to be 1 comma operator and 0 used for octal constnts On Sat, Feb 5, 2011 at 3:01 PM, radha krishnan radhakrishnance...@gmail.com wrote: guess the output

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]

2011-02-05 Thread Gajendra Dadheech
20,1 this would be output Thanks and regards, Gajendra Dadheech Software Engineer-I (RD) MediaTek India Technology Work: 120-4343900(Ext. 276) Mobile: +91-9540646145 - Be the change you want to see in the world

Re: [algogeeks]

2011-02-05 Thread Gajendra Dadheech
x would be 20 as when we put zero in front of any number then this is taken as octel number and value of 024 in decimal would be 20 Thanks and regards, Gajendra Dadheech On Sat, Feb 5, 2011 at 6:30 PM, Gajendra Dadheech gajju3...@gmail.comwrote: 20,1 this would be output Thanks and

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

[algogeeks] Re: c programming question

2011-02-05 Thread Manish Verma
answer will depend on your compiler. On Feb 5, 1:02 am, jagannath prasad das jpdasi...@gmail.com wrote: *#includestdio.h void main(void) { int a=10,b; b=a++ + ++a; printf(%d,%d,%d,%d,b,a++,a,++a); } *what is the answer?how are the function parameters passed on the stack? -- You

[algogeeks] Good question

2011-02-05 Thread Gajendra Dadheech
Calculate size of a data type without using sizeof and without declaring any variable of it Thanks and regards, Gajendra Dadheech -- 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]

2011-02-05 Thread nishaanth
how does it ignore ' , ' for x but not for y ?. Can you explain what happens if u give , in an int. On Sat, Feb 5, 2011 at 6:34 PM, Gajendra Dadheech gajju3...@gmail.comwrote: x would be 20 as when we put zero in front of any number then this is taken as octel number and value of 024 in

Re: [algogeeks] Re: Spoj Problem : Small Factorials

2011-02-05 Thread UTKARSH SRIVASTAV
#includestdio.h long int k; void fact(long int a[],long int n) { long int c=0,temp,i=0; while(i=k) { temp=a[i]*n+c; a[i]=temp%10; c=temp/10; i++; } while(c!=0) { a[i]=c%10; c=c/10; k++; i++; } } main() {

Re: [algogeeks] Re: c programming question

2011-02-05 Thread jagannath prasad das
@ankit:ans is 22 13 14 14 in gcc compiler. On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma monsieur@gmail.com wrote: answer will depend on your compiler. On Feb 5, 1:02 am, jagannath prasad das jpdasi...@gmail.com wrote: *#includestdio.h void main(void) { int a=10,b;

[algogeeks] Re: codechef problem

2011-02-05 Thread juver++
@Dave We may use fractions instead of pure double values. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: c programming question

2011-02-05 Thread juver++
Suppose we have the following statement: f(a) + f(b). The order of evaluating the operads is compiler-dependent. So, on compiler1 f(b) can be calculated first, f(a) at the final step. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] Re: Single Server Queue Simulation Program

2011-02-05 Thread Glauben
Please ... On 4 fév, 21:17, Glauben glauben...@gmail.com wrote: Hello , who have single server queue simulation program c or c++ ? Please All the best . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: Good question

2011-02-05 Thread Venki
Hi Gajendra, See the following link http://geeksforgeeks.org/forum/topic/huwaei-interview-question-for-software-engineerdeveloper-2-5-years-about-cpuzzles#post-18725 On Feb 5, 7:28 pm, Gajendra Dadheech gajju3...@gmail.com wrote: Calculate size of a data type without using sizeof and without

Re: [algogeeks]

2011-02-05 Thread tech rascal
yeah, plz explain the effect/use of comma operator. On Sat, Feb 5, 2011 at 8:16 PM, nishaanth nishaant...@gmail.com wrote: how does it ignore ' , ' for x but not for y ?. Can you explain what happens if u give , in an int. On Sat, Feb 5, 2011 at 6:34 PM, Gajendra Dadheech

[algogeeks] Re: c programming question

2011-02-05 Thread Manish Verma
i think juver has explained On Feb 5, 9:34 pm, jagannath prasad das jpdasi...@gmail.com wrote: @manish:can you explain with the example of a specific compiler... On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das jpdasi...@gmail.comwrote: @ankit:ans is 22 13 14 14 in gcc

Re: [algogeeks] Re: c programming question

2011-02-05 Thread tech rascal
but can nybody explain why the output is coming like this on gcc compiler?? On Sun, Feb 6, 2011 at 10:04 AM, Manish Verma monsieur@gmail.comwrote: i think juver has explained On Feb 5, 9:34 pm, jagannath prasad das jpdasi...@gmail.com wrote: @manish:can you explain with the example of a

Re: [algogeeks]

2011-02-05 Thread RB
The comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, it then evaluates the second operand and returns this value (and type). The comma operator has the lowest precedence of any C operator, and acts as a sequence point.

Re: [algogeeks]

2011-02-05 Thread Balaji S
well, i can understand how x gets 20...but how y becomes 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

Re: [algogeeks]

2011-02-05 Thread RB
since comma operator has the lowest precedence of any C operator (y=1),024; thus y=1 On Feb 6, 10:18 am, Balaji S balaji.ceg...@gmail.com wrote: well, i can understand how x gets 20...but how y becomes 1??? -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] kurukshetra...

2011-02-05 Thread Balaji S
can anyone tell how to evaluate max(a,b) using abs() function...?? -- balaji ;-) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

[algogeeks] Re: kurukshetra...

2011-02-05 Thread Dave
max(a,b) = (abs(a+b)+abs(a-b))/2; Dave On Feb 5, 11:39 pm, Balaji S balaji.ceg...@gmail.com wrote: can anyone tell how to evaluate max(a,b) using abs() function...?? -- balaji ;-) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] interview quest..

2011-02-05 Thread Balaji S
can anyone help..? Suppose we have a string RGBBGBGR. we have to eliminate the couple (two same chars adjacent to each other) recursively. For example RGBBGBGR -- RGGBGR--RBGR -- balaji ;-) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Amazon interview quesiton

2011-02-05 Thread Gajendra Dadheech
A special type of tree is given, where all leaf are marked with L and others are marked with N. every node can have 0 or at most 2 nodes. Trees preorder is given, create tree from that traversal. Thanks and regards, Gajendra Dadheech -- You received this message because you are subscribed to

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: