Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:49:13+00:00 2026-06-06T08:49:13+00:00

I have been wondering and couldn’t find a clear answer on this subject. Imagine

  • 0

I have been wondering and couldn’t find a clear answer on this subject.

Imagine the following two examples.

int i;
for(i=0;i<maxLimit;i++)
{
    //code here
}

2nd example

for(int i=0;i<maxLimit;i++)
{
    //code here
}

Basically if they are like that I believe both would behaviour exactly the same but my questioning comes into place when considering this

while(!file.EOF)
{
    for(int i=0;i<maxLimit;i++)
    {
        //code here
    }
}

When the 2nd example is inside a loop itself how does it perform? Is it more efficient to declare it beforehand and simply put it back to 0 or is the execution time the same as declaring it inside?

Personnally I usually put it like number 2 because I find it better visually speaking. But I,m wondering if it’s inside a loop what the effect of it would be.

Thank you for your answers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:49:16+00:00Added an answer on June 6, 2026 at 8:49 am

    Most modern compilers are sufficiently sophisticated that any decision you make at this level is likely to make no difference whatsoever (to clarify, after analysis the compiler may have transformed both into the same internal representation – being the most efficient implementation). But if you’re not convinced, the golden rule in this kind of case is to check with a profiler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching around and I couldn't find the following. I was wondering
I have been wondering about the following lines of code [self performSelector:@selector(myMethod) withObject:self afterDelay:1.0];
I ran into this RegExp /[[0]]/ in JavaScript, and have been wondering what it
Here's something I couldn't find an answer to. Say you have a form and
I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
I know there have already been questions very similar to this, but I couldn't
I have been working with a few examples have been wondering what the benefits
First off, apologies if this question has been asked before but I couldn't find
I have been wondering about how people manage their strings if they are likely
I have been wondering about the reload() function in python, which seems like it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.