Re: [algogeeks] O/P

2011-08-12 Thread Amol Sharma
@dipankar +1 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Fri, Aug 12, 2011 at 9:31 AM, Dipankar Patro dip10c...@gmail.com wrote: The question is full of errors. Provide the link, if you have copied it from somewhere. On 11 August 2011 23:53,

[algogeeks] O/P

2011-08-11 Thread Mani Bharathi
What will be the output of the following program #include int main() { int m=10,p; p=incre(incre (incre (++) incre) incre) Printf(%d, *P); return 0; } incre (int m) { m+=2; return(m-2); } how? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] O/P

2011-08-11 Thread Dipankar Patro
The question is full of errors. Provide the link, if you have copied it from somewhere. On 11 August 2011 23:53, Mani Bharathi manibharat...@gmail.com wrote: What will be the output of the following program #include int main() { int m=10,p; p=incre(incre (incre (++) incre) incre)

Re: [algogeeks] o/p

2011-08-09 Thread Prakash D
@rajkumar: thanks #include stdio.h #define max(a,b) ((ab)?a:b) int main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(%d,%d,m,n); getchar(); return 0; } this gives the correct output as 6,6 On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro dip10c...@gmail.com wrote: relational

[algogeeks] o/p

2011-08-08 Thread Kamakshii Aggarwal
#include stdio.h #define max(a,b)(ab)?a:b int main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(%d,%d,m,n); getchar(); return 0; } y the o/p is 2,3,,please explain -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google

Re: [algogeeks] o/p

2011-08-08 Thread Neeraj Gupta
Precedence of + is higher than ? On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: #include stdio.h #define max(a,b)(ab)?a:b int main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(%d,%d,m,n); getchar(); return 0; } y the o/p is

Re: [algogeeks] o/p

2011-08-08 Thread jagrati verma
#define max(a,b)((ab)?a:b) use parenthese thn it will giv the correct o/p On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: #include stdio.h #define max(a,b)(ab)?a:b int main() {  int m,n;  m=3+max(2,3);  n=2*max(3,2);  printf(%d,%d,m,n);     getchar();  

Re: [algogeeks] o/p

2011-08-08 Thread Kamakshii Aggarwal
thanks..got it... On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma jagrativermamn...@gmail.comwrote: #define max(a,b)((ab)?a:b) use parenthese thn it will giv the correct o/p On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: #include stdio.h #define

Re: [algogeeks] o/p

2011-08-08 Thread Shachindra A C
the statement will be transformed to : m=3+(23)?2:3; n=2*(32)?3:2; which will become m = 3 + 0 ? 2 : 3; n = 2 * 1 ? 3 : 2; On Mon, Aug 8, 2011 at 3:46 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: thanks..got it... On Mon, Aug 8, 2011 at 3:45 PM, jagrati verma

Re: [algogeeks] o/p

2011-08-08 Thread raj kumar
I think you forgot to give a space between macro and it's expansion that's why max(a,b)(ab)?a:b is getting expanded to null and the above result -- 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] o/p

2011-08-08 Thread raj kumar
Sorry that's not the reason i running that code on my machine i understood the reason is something else -- 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

Re: [algogeeks] o/p

2011-08-08 Thread Prakash D
how 2,3 any idea?? On Mon, Aug 8, 2011 at 5:09 PM, raj kumar megamonste...@gmail.com wrote: I think you forgot to give a space between macro and it's expansion that's why max(a,b)(ab)?a:b is getting expanded to null and the above result -- You received this message because you are

Re: [algogeeks] o/p

2011-08-08 Thread raj kumar
3+23?2:3 so 53 hence 2 is returned bcoz of higher precedence of + over ? Thanks -- 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] o/p

2011-08-08 Thread Shachindra A C
@raj, the preprocessed file would contain m=3+(23)?2:3 AFAIK. So, the statement would evaluate to 3 + 1 ? 2 : 3 == 4 ? 2 : 3 == m = 2. Likewise for n. On Mon, Aug 8, 2011 at 5:21 PM, raj kumar megamonste...@gmail.com wrote: 3+23?2:3 so 53 hence 2 is returned bcoz

Re: [algogeeks] o/p

2011-08-08 Thread Shachindra A C
oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 == *3* ? 2 : 3 == m = 2. On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C sachindr...@gmail.comwrote: @raj, the preprocessed file would contain m=3+(23)?2:3 AFAIK. So, the statement would evaluate to 3 + 1 ? 2

Re: [algogeeks] o/p

2011-08-08 Thread dilip makwana
Since test condition will always evaluate to non-zero value (which is considered true in c/c++) hence always first option get selected On 8 August 2011 17:44, Shachindra A C sachindr...@gmail.com wrote: oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 == *3*? 2 : 3 == m

Re: [algogeeks] o/p

2011-08-08 Thread Anil Arya
in expression (ab)?a:b---(ab) returns 1 if true and 0 if (false) . On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana dilipmakwa...@gmail.comwrote: Since test condition will always evaluate to non-zero value (which is considered true in c/c++) hence always first option get selected

Re: [algogeeks] o/p

2011-08-08 Thread Dipankar Patro
relational operators give 0/1 output; (ab) - will be either 0 or 1. similarly (a==b) will either be 0 or 1 On 8 August 2011 18:39, Anil Arya anilarya...@gmail.com wrote: in expression (ab)?a:b---(ab) returns 1 if true and 0 if (false) . On Mon, Aug 8, 2011 at 6:08 PM, dilip

[algogeeks] o/p

2011-08-07 Thread Kamakshii Aggarwal
what is the problem with the following code void fun(int **p) { static int q = 10; *p = q; } int main() { int r = 20; int *p = r; fun(*p); printf(%d, *p); getchar(); return 0; } -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are

[algogeeks] o/p

2011-02-06 Thread ranjane
what s the o/p of the followin pgm? main() { int i=300; char *ptr; 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, send email to algogeeks@googlegroups.com. To unsubscribe from this

Re: [algogeeks] o/p

2011-02-06 Thread Gajendra Dadheech
i think it will be 34... Thanks and regards, Gajendra Dadheech On Sun, Feb 6, 2011 at 10:15 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: @ranjane the value of i will not change as ++ptr will execute first. but i wonder if a char pointer can be used to store integer address... will

Re: [algogeeks] o/p

2011-02-06 Thread aditya pratap
i do'nt know why it is printing 556. could anyone give me the logic. Aditya Pratap MCA II Delhi University -- 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

Re: [algogeeks] o/p

2011-02-06 Thread jalaj jaiswal
@aditya which compiler are you using On Sun, Feb 6, 2011 at 10:21 PM, aditya pratap contacttoadity...@gmail.comwrote: i do'nt know why it is printing 556. could anyone give me the logic. Aditya Pratap MCA II Delhi University -- You received this message because you are subscribed to

Re: [algogeeks] o/p

2011-02-06 Thread aditya pratap
@jalaj : gcc compiler. -- 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,

Re: [algogeeks] o/p

2011-02-06 Thread jalaj jaiswal
the logic is :- int is stored in 32 bits in our systems 300 is 0001 00101100 as ptr is character pointer, it points to lower 8 bits and when *++ptr=2 gets executed then 0001 changes to 0010(equal to 2) so i becomes 0010 00101100 which is 556 :D

[algogeeks] o/p of strlen()

2010-06-15 Thread mohit ranjan
Hi All, char s[]={'a', 'b', 'c', 'd'}; printf(%d\n, strlen(s)); o/p is 8 can anybody plz explain why 8 ? Mohit -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To

Re: [algogeeks] o/p of strlen()

2010-06-15 Thread Amir hossein Shahriari
you didn't put an '\0' at the end of the string strlen looks for a '\0' in the string and here it happened to be 8 bytes after the starting position of s On 6/15/10, mohit ranjan shoonya.mo...@gmail.com wrote: Hi All, char s[]={'a', 'b', 'c', 'd'}; printf(%d\n, strlen(s)); o/p is 8 can

[algogeeks] o/p

2010-06-05 Thread sharad
#includestdio.h int main() { short int i=0; for(i=5i=-1;++i;i0) printf(%u\n,i); return 0; } o/p coming is 1...4,294,967,295 short int is of 2 bytes can any one plzz explain the o/p -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] o/p

2010-06-05 Thread divya jain
output on my compiler is 165535 as i=0 initialy ++i is true and so for loop condition is true and printf is executed. when i becomes 65535 then ++i is equal to 0 and so for loop condition becomes false. On 5 June 2010 13:44, sharad sharad20073...@gmail.com wrote: #includestdio.h int main()

Re: [algogeeks] o/p

2010-06-05 Thread sharad kumar
@divya,which compiler u r using,i m getting this o/p on gcc compiler @mohit:loop stops at 4,294,967,295 in gcc -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe

Re: [algogeeks] o/p

2010-06-05 Thread Rohit Saraf
If you make it unsigned short int.. then it goes to 65535 on g++/gcc -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are

Re: [algogeeks] o/p

2010-06-05 Thread divya jain
turbo c++ and my o/p is logical as well On 5 June 2010 17:58, sharad kumar sharad20073...@gmail.com wrote: @divya,which compiler u r using,i m getting this o/p on gcc compiler @mohit:loop stops at 4,294,967,295 in gcc -- You received this message because you are subscribed to the Google