one line c expression to print 1 -100 num

C

Chris Dollin

bobby said:
expression is i=i<100?i++,main(),++i:1;

I see a control structure.

The original post says "with out using control statements/structures".
Since control /structures/ is explicitly stated as well as control
/statements/, conditional expressions (and && and ||) shouldn't be
allowed ...
 
A

Army1987

expression is i=i<100?i++,main(),++i:1;
Elsethread you said that it mustn't call any function.
That expression calls main(), so according to your specifications
it is wrong.
 
C

Charlton Wilbur

b> expression is i=i<100?i++,main(),++i:1;

Except that the ternary operator (?:) is a control structure, and this
sort of recursion involves a conditional jump.

Your professor is insufficiently precise with his terms.

Charlton
 
S

santosh

Dik said:
Consider the comma operator.

I hope the resulting statement will fit within a single logical source
line. Or does the OP mean a single physical line when he wants an "one
line" expression?
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,220
Latest member
MathewSant

Latest Threads

Top