How long does this loop run:

for(int x=0; x=3; x++)
a) Never
b) Three times
c) Forever

Answer Posted / pracheer gupta

what r u saying guys..
the loop will run c) forever
this is bcoz in the termination part it is actually x=3 and
not x==3.
x=3 will always evaluate to true and hence the loop is
executed infinite times.

Is This Answer Correct ?    91 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I disable the "echo" feature?

607


How do pointers work?

703


Can class objects be passed as function arguments?

605


What is the use of dot in c++?

620


Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

3371






What is time_t c++?

608


Are c and c++ different?

539


What is an overflow error?

619


Array base access faster or pointer base access is faster?

1815


Which software is best for programming?

661


Define upcasting.

592


the maximum length of a character constant can be a) 2 b) 1 c) 8

602


What are the uses of typedef in a program?

614


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

602


Who invented turbo c++?

607