Computer Science - Object Oriented Programming Using C++ - Discussion

1. 

The comma operator (,) is primarily used in conjunction with

[A]. 'for' statement
[B]. 'if-else' statement
[C]. 'do-while' statement
[D]. All of the above
[E]. None of the above

Answer: Option A

Explanation:

No answer description available for this question.

Shivam said: (Jan 11, 2014)  
As we know that syntax of for loop:

for(__,__,__)
{
}

User42 said: (Jan 30, 2014)  
Umm no it's not and this question needs updated because E is the correct answer. A for loop separates its arguments using a semi-colon, not a comma.

Waqas said: (Dec 4, 2014)  
No it's not true because,

for(init; condition; increment)
{
statement(s);
}

Arun said: (Nov 24, 2015)  
Yes because we use semicolon (;) in for loop. Its right and A answer is wrong.

Shubham Shrivastava said: (Mar 8, 2016)  
No option A is wrong because in for loop we use semicolon(;).

Kathirvel said: (Jul 23, 2016)  
This question is very useful, Thank you.

Ayesha Ran said: (Jun 21, 2020)  
The correct syntax for running two variable for loop simultaneously.


for (i = 0; i < n; i++)
for (j = 0; j < n; j += 5)

Running two variable for loop simultaneously. Using Comma;
for (i = 0, j = 0; i < n, j < n; i++, j += 5)

So, the answer is A.

Ayesha... said: (Jun 22, 2020)  
The syntax for running two variable for loop simultaneously.

for (i = 0, j = 0; i < n, j < n; i++, j += 5)

Nikhil Sharma said: (Feb 4, 2021)  
Thanks for clearing it @Ayesha.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.