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 8749829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:45:35+00:00 2026-06-13T12:45:35+00:00

This is really strange. This program was working fine on another computer, but when

  • 0

This is really strange. This program was working fine on another computer, but when I try it on this one it runs forever. Also it is a for loop, which adds even more to my confusion. SIZE_OF_DATA is a preprocessor variable, which I think might be causing the problem.. But I don’t know. When I add a printf, it shows only one iteration of the outside loop and is looping infinitely in the inner loop. I have no idea why.

for(i=0; i<size; i++){
    for(j=0;j<SIZE_OF_DATA; j++){
      aArray[i*SIZE_OF_DATA + j] = aPointer[i]->b[j]; 
      cArray[i*SIZE_OF_DATA + j] = 0;                            
      dArray[i*SIZE_OF_DATA + j] = i*SIZE_OF_DATA + j;
      if (i==0)
        eArray[j] = 0;
    }
  }

I’m worried that I somehow destroyed my program… But I have barely done anything but add comments!

  • 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-13T12:45:36+00:00Added an answer on June 13, 2026 at 12:45 pm

    This:

    aArray[i*SIZE_OF_DATA + j]
    

    looks like you might be writing outside the array (cArray and dArray too) in the last iteration. Are you sure you’re getting a correct index into the array? If not, through the wonders of undefined behavior, you are probably writing to memory that belongs to other variables, including i and j, which could make this loop go on forever.

    Buggy programs with undefined behavior behave very… undefined. Though without seeing more code, no one can be sure.

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

Sidebar

Related Questions

This is really strange but this code is working fine unless the value entered
This is a really strange issue. One day my project started to do a
Today I got a really strange problem. Try to execute this C# code: class
I'm working on an ASP.NET project and I've started getting this really strange error
This seems really strange to me: f = File.open(Dir.pwd+'/tmp','r') f.readlines do |l| puts #{f.lineno}:#{l}
this is really strange, yesterday I asked the question Yesterdays question how to implement
This is a really strange problem, that appears to be somewhat intermittent (although it
I'm getting a really strange NPE exception. This is the offending code: private static
I've a question about weka as this person: Hi all: I felt really strange
This really seems like a bug to me, but perhaps some databinding gurus can

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.