Can anyone tell me what this following statement means in C++..

return (tos==0?1:0)

where tos is a variable..
Thanks..!!

Recommended Answers

All 4 Replies

The exact same would be:

if (tos==0) {		// tos==0?
	return 1;	// 1
} else {		// :
	return 0;	// 0
}

But as you can see

return (tos==0?1:0)

is much easier to write.

Please help me clarify the meaning of below line in VC++. Thanks in advance

x += (a/b) + ((a%b)?1:0);

The question was already answered, why don't you read previous replies?
Thread closed before another time-traveller arrives.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.