respected sir,
pls sir can you give details and more info about forloop

Hello sunny,

If it's general knowledge about the for loop you want, I will be more than happy to provide some insight. If it is a specific problem involving for loops, I will also be more than happy to help, if you provide enough information. So here we go:

A for loop is a C++ operation that is based on 3 conditions. The first is initialization, the second is the terminating condition, and the third is the update.

For loops are processor friendly when referring to speed. They can be used to do things like index arrays, which can save considerable amounts of typing code. Here is an example:

int array[4];

array[0] = 0;
array[1] = 1;
array[2] = 2;

.... and so on can be converted to

for(int i = 0; i < 4; i++)
array[i] = i;

Notice the 3 steps: initializing i to 0, the terminating condition is when i is no longer less than 4, and the update increments i.

I hope this information was helpful.

- Eddie  


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 About.com. All rights reserved.