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

  • Home
  • SEARCH
  • 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 6033973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:33:41+00:00 2026-05-23T05:33:41+00:00

I have one doubt in the following snippet. Actually I am initializing all the

  • 0

I have one doubt in the following snippet. Actually I am initializing all the array index to zero in following code, but this for loop is going infinitely. I found reason that we are trying to access the 26th index of array, so that value gets initialized to zero again since there is 0 to 25 index. So the for loop is going infinitely. Explain if any one the actual reason behind this stuff.

int array[26];
int i; 
for (i = 0; i <= 26; i++) 
    array[i]= 0;
  • 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-05-23T05:33:42+00:00Added an answer on May 23, 2026 at 5:33 am

    You have to use i < 26; otherwise you exceed the array bounds.

    Due to the layout of the stack on most systems array[26] will point to the memory used for i which results in the loop starting again since you loop body is setting i to 0 instead of an appropriate array element.

    Note that you can simply use int array[36] = { 0 }; to create the array with all elements being set to 0.

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

Sidebar

Related Questions

In following program . I have one doubt. I have declared one global variable
I have a small doubt I have following code bool res= false; if(cond1) {
I have a doubt i use the following piece of code get data from
I have doubt and need some suggestion on following code, NSArray* onscreenwindows = (NSArray*)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly,
I doubt this is possible, but I was curious if you could have more
This is no doubt a newbish question, but I have looked for an answer
I have one doubt regarding casting. public void Test(out T a, out T b)
I have one doubt in string . How can we acess the memory of
I have one doubt concerning c# method overloading and call resolution. Let's suppose I
I have a doubt in layouts.I have designed one layout using group layout using

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.