473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

eager to say 46

#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 1209
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

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
c world <ex**********@gmail.comwrote:
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. Do the macro expansion by hand (it's not
that complicated) and remember that certain operators have
higher precedence then others (not only in C but also when
you do calculations on a piece of paper...)

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Aug 14 '07 #4
"sumedh....." <su**********@gmail.comwrote:
what shud be the o/p of prog and why?
Has it ever occurred to you that there could be a purpose to doing your
own homework? You're not set these problems just to get you off the
teacher's back, you know.

Richard
Aug 14 '07 #5
Jens Thoms Toerring said:
c world <ex**********@gmail.comwrote:
>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.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 14 '07 #6
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
Mark Bluemel <ma**********@pobox.comwrote:
(Time for Sumedh..... to go in my killfile, I think)
That's one of the reasons I'm filtering all Google posts at the
moment.

--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
Aug 14 '07 #8
Richard Heathfield wrote:
Jens Thoms Toerring said:
c world <ex**********@gmail.comwrote:
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 an actual
suffusion of yellow?

Brian
Aug 14 '07 #9
Default User said:
Richard Heathfield wrote:
>Jens Thoms Toerring said:
c world <ex**********@gmail.comwrote:
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 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.

Cf Douglas Adams, "The Long Dark Teatime of the Soul".

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 14 '07 #10
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
Richard Heathfield wrote:
Default User said:
>Richard Heathfield wrote:
>>Jens Thoms Toerring said:
c world <ex**********@gmail.comwrote:
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 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.
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.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Aug 15 '07 #12
CBFalconer <cb********@yahoo.comwrites:
[...]
Hey, we're talking about real computers here. I know of no
hardware that is capable of actually outputting a suffusion of
yellow.
You've never seen a can of spray paint?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 15 '07 #13
Richard Heathfield wrote:
Jens Thoms Toerring said:
>c world <ex**********@gmail.comwrote:
>>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
In article <46***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>Hey, we're talking about real computers here. I know of no
hardware that is capable of actually outputting a suffusion of
yellow.
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
Richard Heathfield <rj*@see.sig.invalidwrites:
Default User said:
>Richard Heathfield wrote:
>>Jens Thoms Toerring said:

c world <ex**********@gmail.comwrote:
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 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.
You guys are really clever. Did you know that?
Aug 15 '07 #16
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 <ex**********@gmail.comwrote:
>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 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.

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Terje Slettebø | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is...
23
by: Anthony | last post by:
Hello I'm currently trying to read Core Python Programming, but by the looks of it im never going to get done the book is about 860 pages long real intimidating, but im guess im going to have to...
36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
0
by: jack | last post by:
Check it out:Very good online resources,tons of cool men and beautiful women eager for lovers....: 1.Buy tickets online:...
1
by: Kay Schluehr | last post by:
Here is an evil imperative, non-recursive generator: def ncsub(seq): n = len(seq) R = xrange(n+1) for i in xrange(1,2**n): S = nc = False for j in R: k = i>>j
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.