435,062 Members | 1,358 Online
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

# eager to say 46

 P: n/a #define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); } what shud be the o/p of prog and why? Aug 14 '07 #1
16 Replies

 P: n/a sumedh..... wrote: #define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); } what shud be the o/p of prog and why? If you can't cope with your homework, talk to your instructor. Most of us, if not all, won't do it for you... (Time for Sumedh..... to go in my killfile, I think) Aug 14 '07 #2

 P: n/a sumedh..... wrote: #define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); } what shud be the o/p of prog and why? it seems to be tricky one: but o/p is 26 Aug 14 '07 #3

 P: n/a c world

 P: n/a "sumedh....."

 P: n/a Jens Thoms Toerring said: c world sumedh..... wrote: #define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); } what shud be the o/p of prog and why? >it seems to be tricky one:but o/p is 26 Not tricky at all. On my system, the above program outputs "a suffusion of yellow". Perhaps the OP missed a trick. -- Richard Heathfield Email: -www. +rjh@ Google users: "Usenet is a strange place" - dmr 29 July 1999 Aug 14 '07 #6

 P: n/a sumedh..... wrote: #define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); } what shud be the o/p of prog and why? The output /should/ be "do your own homework, and work out what the answer implies about what you should do with macro arguments that are supposed to be expressions". Sadly, the Standard mandates otherwise. -- Chris "what /do/ they teach them in schools nowadays?" Dollin Hewlett-Packard Limited registered no: registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England Aug 14 '07 #7

 P: n/a Mark Bluemel

 P: n/a Richard Heathfield wrote: Jens Thoms Toerring said: c world

 P: n/a Default User said: Richard Heathfield wrote: >Jens Thoms Toerring said: c world Email: -www. +rjh@ Google users: "Usenet is a strange place" - dmr 29 July 1999 Aug 14 '07 #10

 P: n/a On my system, the above program outputs "a suffusion of yellow". Wait, does it output the words "a suffision of yellow" or an actual suffusion of yellow? It writes to the standard output device the four-word phrase "a suffusion of yellow" (not "a suffision of yellow"), sans quotation marks, and follows it with a newline character. That usually indicates the result is greater than 4. So the answer should be 'greater than 4' Alas in my experience the answer is rarely as important as how you get there, something about the difference between knowledge and wisdom. Aug 14 '07 #11

 P: n/a Richard Heathfield wrote: Default User said: >Richard Heathfield wrote: >>Jens Thoms Toerring said:c world >#define f(a,b) a+b> #define g(a,b) a*b>>> main() {> int m;> m=2*f(3,g(4,5));> printf("\n m is %d",m);> system("pause");> }>>>what shud be the o/p of prog and why?it seems to be tricky one: but o/p is 26Not tricky at all.On my system, the above program outputs "a suffusion of yellow". Wait, does it output the words "a suffision of yellow" or anactual suffusion of yellow? It writes to the standard output device the four-word phrase "a suffusion of yellow" (not "a suffision of yellow"), sans quotation marks, and follows it with a newline character. Hey, we're talking about real computers here. I know of no hardware that is capable of actually outputting a suffusion of yellow. -- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems. -- Posted via a free Usenet account from http://www.teranews.com Aug 15 '07 #12

 P: n/a CBFalconer San Diego Supercomputer Center <* "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" Aug 15 '07 #13

 P: n/a Richard Heathfield wrote: Jens Thoms Toerring said: >c world >sumedh..... wrote:#define f(a,b) a+b #define g(a,b) a*b main() { int m; m=2*f(3,g(4,5)); printf("\n m is %d",m); system("pause"); }what shud be the o/p of prog and why?it seems to be tricky one:but o/p is 26 Not tricky at all. On my system, the above program outputs "a suffusion of yellow". Perhaps the OP missed a trick. I wish the compilers I used did that. It's much nicer than their messages. Aug 15 '07 #14

 P: n/a In article <46***************@yahoo.com>, CBFalconer Hey, we're talking about real computers here. I know of nohardware that is capable of actually outputting a suffusion ofyellow. It's called a "printer". -- Richard -- "Consideration shall be given to the need for as many as 32 characters in some alphabets" - X3.4, 1963. Aug 15 '07 #15

 P: n/a Richard Heathfield Richard Heathfield wrote: >>Jens Thoms Toerring said:c world

 P: n/a On Tue, 14 Aug 2007 21:53:53 -0400, CBFalconer wrote: Richard Heathfield wrote: >Default User said: >>Richard Heathfield wrote:Jens Thoms Toerring said:c world sumedh..... wrote:>>>>#define f(a,b) a+b>> #define g(a,b) a*b>>>>> main() {>> int m;>> m=2*f(3,g(4,5));>> printf("\n m is %d",m);>> system("pause");>> }>>>>>what shud be the o/p of prog and why?>>it seems to be tricky one: but o/p is 26>Not tricky at all.On my system, the above program outputs "a suffusion of yellow".Wait, does it output the words "a suffision of yellow" or anactual suffusion of yellow? It writes to the standard output device the four-word phrase "asuffusion of yellow" (not "a suffision of yellow"), sansquotation marks, and follows it with a newline character. Hey, we're talking about real computers here. I know of no hardware that is capable of actually outputting a suffusion of yellow. Most inkjets, IME, are incapable of outputting anything _but_ a suffusion of something - and most do, indeed, have yellow. Aug 16 '07 #17

### This discussion thread is closed

Replies have been disabled for this discussion.