Behaviour

P

prasoonthegreat

int i=3;
printf("%d %d %d",++i,i,i++);

I want to know whether the above shows Undefined Behaviour or
Unspecified Behaviour ????
 
K

Keith Thompson

int i=3;
printf("%d %d %d",++i,i,i++);

I want to know whether the above shows Undefined Behaviour or
Unspecified Behaviour ????

It's undefined behavior. See C99 6.5p2.
 
B

Barry Schwarz

int i=3;
printf("%d %d %d",++i,i,i++);

I want to know whether the above shows Undefined Behaviour or
Unspecified Behaviour ????

Read the faq at www.c-faq.com. Your question is 3.2 but you should
read the whole thing.
 
P

prasoonthegreat

here ',' in the printf statement is not a sequence point .....
am I correct???
 
K

Keith Thompson

here ',' in the printf statement is not a sequence point .....
am I correct???

Correct -- "here" being in the code in the previous article, which we
can't see in your followup. When you post a followup, please keep
enough quoted context from the previous article so your followup makes
some sense to a reader who didn't see (or has forgotten) the previous
article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top