Re: [algogeeks] preprocessor directives
I think "k" value will depend on compiler as we have changed "i" value in the expression "k = ++i*++i" and used it again in the same 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] preprocessor directives
@Vijay.. thanx brother very well explained and now I understand clearly On Mon, Jul 25, 2011 at 8:37 PM, Vijay Khandar wrote: > O/P=9 and 49 > since i++ * i++ and++ is postincrement so 3*3=9 then both i++ * i++ goes to > 4and 5 > now i=5. > > then for ++i*++i and ++ is preincrement so first it will 6 and 7 and then > 7*7=49 > > > Vijay.. > > On Mon, Jul 25, 2011 at 8:22 PM, Arshad Alam wrote: > >> what would be the output of the below program give little explanations >> >> #include >> #include >> #define PRODUCT(x) (x*x) >> void main() >> { >> int i=3,j,k; >> j=PRODUCT(i++); >> k=PRODUCT(++i); >> printf("\n%d %d",j,k); >> 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. > -- 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] preprocessor directives
O/P=9 and 49 since i++ * i++ and++ is postincrement so 3*3=9 then both i++ * i++ goes to 4and 5 now i=5. then for ++i*++i and ++ is preincrement so first it will 6 and 7 and then 7*7=49 Vijay.. On Mon, Jul 25, 2011 at 8:22 PM, Arshad Alam wrote: > what would be the output of the below program give little explanations > > #include > #include > #define PRODUCT(x) (x*x) > void main() > { > int i=3,j,k; > j=PRODUCT(i++); > k=PRODUCT(++i); > printf("\n%d %d",j,k); > 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] preprocessor directives
On Mon, Jul 25, 2011 at 8:22 PM, Arshad Alam wrote: > what would be the output of the below program give little explanations > > #include > #include > #define PRODUCT(x) (x*x) > void main() > { > int i=3,j,k; > j=PRODUCT(i++); > k=PRODUCT(++i); > printf("\n%d %d",j,k); > getch(); > } > 9 49 Regards, B.C.Someshwar -- 'Talk sense to a fool and he calls you foolish.' - Euripides My Blog: somsekaran.wordpress.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.
[algogeeks] preprocessor directives
what would be the output of the below program give little explanations #include #include #define PRODUCT(x) (x*x) void main() { int i=3,j,k; j=PRODUCT(i++); k=PRODUCT(++i); printf("\n%d %d",j,k); 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.