How long does this loop run:
for(int x=0; x=3; x++)
a) Never
b) Three times
c) Forever
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / manju
The correct and verified answer is the loop runs forever
the answer is c. it is so becoz in condition part we are
giving i=3 and not i==3.
so it executes infinite times.
Is This Answer Correct ? | 32 Yes | 3 No |
Answer / eric
The loop will run forever.
K.premalatha is the foolest lady I have ever met.
Is This Answer Correct ? | 17 Yes | 3 No |
Answer / john
the loop runs forever guys....
have you tried this? without trying u r giving the random answers?
Sentrix, Eric, Manju,Pracheer Gupta are right...
other guys please try it....
Is This Answer Correct ? | 17 Yes | 4 No |
Answer /
#include<stdio.h>
main()
{
for(int x=0; x=3; x++)
printf("Forever.....");
}
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / divya
hai john I tried this in online compiler but it shows some errors....didnt give exact ans...Is there any other ways to conform this answer.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / awaneesh dubey
Never . It will show compile time error . boolean required
at the terminationa condition not int . i.e. it should be
for(int x=0; x==3; x++) not for(int x=0; x=3; x++) .
x=3 will cause compilation error. So answer is never .
Is This Answer Correct ? | 1 Yes | 1 No |
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
What do you mean by static variables?
How do you declare A pointer to function which receives an int pointer and returns a float pointer
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
What are the manipulators in c++?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
In c++, what is the difference between method overloading and method overriding?
In which memory a class gets stored(in heap /in stack)? And why??
Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What is the difference between while and do while loop?
What are function prototypes?