Computer Science - Object Oriented Programming Using C++ - Discussion
Discussion Forum : Object Oriented Programming Using C++ - Section 7 (Q.No. 1)
1.
The comma operator (,) is primarily used in conjunction with
Discussion:
10 comments Page 1 of 1.
Shivam said:
1 decade ago
As we know that syntax of for loop:
for(__,__,__)
{
}
for(__,__,__)
{
}
User42 said:
1 decade ago
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:
1 decade ago
No it's not true because,
for(init; condition; increment)
{
statement(s);
}
for(init; condition; increment)
{
statement(s);
}
Arun said:
10 years ago
Yes because we use semicolon (;) in for loop. Its right and A answer is wrong.
Shubham Shrivastava said:
9 years ago
No option A is wrong because in for loop we use semicolon(;).
Kathirvel said:
9 years ago
This question is very useful, Thank you.
Ayesha... said:
5 years ago
The syntax for running two variable for loop simultaneously.
for (i = 0, j = 0; i < n, j < n; i++, j += 5)
for (i = 0, j = 0; i < n, j < n; i++, j += 5)
Ayesha Ran said:
5 years ago
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.
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.
Nikhil Sharma said:
5 years ago
Thanks for clearing it @Ayesha.
Digvijay Khot said:
3 years ago
@All.
No,It should be like;
for(initialisation ; condition ; increment)
{
statement(s);
}
so, the ans should be E) none.
No,It should be like;
for(initialisation ; condition ; increment)
{
statement(s);
}
so, the ans should be E) none.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers