What is a loop? What are different types of loops in c++?



What is a loop? What are different types of loops in c++?..

Answer / Vaibhav Tripathi

A loop is a control structure that allows the program to repeatedly execute a block of code as long as a certain condition is true. In C++, there are three types of loops:
1. For Loop: Used for counting or iterating over a specific range.
2. While Loop: Continuously executes a loop until a specific condition becomes false.
3. Do-While Loop: Similar to the while loop but checks the condition after the loop body is executed at least once.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is set in c++?

1 Answers  


Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].

1 Answers  


What is code reusability in c++?

1 Answers  


Describe public access specifiers?

1 Answers  


What is a .lib file in c++?

1 Answers  


Why preincrement operator is faster than postincrement?

5 Answers  


Difference between a copy constructor and an assignment operator.

1 Answers  


How to implement flags?

2 Answers   Symphony,


Refer to a name of class or function that is defined within a namespace?

1 Answers  


What is the basic structure of c++ program?

1 Answers  


Can we sort map in c++?

1 Answers  


Define friend function.

1 Answers  


Categories