1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sukhopar [10]
2 years ago
5

What is the best way to locate where my C program gets into an infinite loop

Computers and Technology
1 answer:
Anni [7]2 years ago
5 0
You could put in a printf() statement to print the value of the index into each loop that you have. You can also step through each loop and read EXACTLY what the program is doing. This is a good skill to develop because your mind has a habit of "fixing" small errors that computers don't.

Computers do exactly what they're told to do, not what you want the to do.
You might be interested in
Create a function named CountVowels() that takes one parameter name epsilon
LenaWriter [7]

def CountVowels(epsilon):

   countNum = 0

   for x in range(len(epsilon)):

       letter = epsilon[x]

       if letter.lower() in "aeiou":

           countNum += 1

   return countNum

def ExtractOdds(zeta):

   result = ""

   for x in range(len(zeta)):

       if x % 2 == 1:

           result += zeta[x]

   return result

sentence_A = input("Enter a sentence: ")

sentence_B = input("Enter a sentence: ")

print(CountVowels(sentence_A))

print(ExtractOdds(sentence_B))

I hope this helps!

5 0
2 years ago
Write a loop that sets new scores to old scores shifted once left, with element 0 copied to the end. ex: if old scores = {10, 20
Inga [223]

#include <iostream>
using namespace std;

int main() {
   const int SCORES_SIZE = 4;
   int oldScores[SCORES_SIZE];
   int newScores[SCORES_SIZE];
   int i = 0;

   oldScores[0] = 10;
   oldScores[1] = 20;
   oldScores[2] = 30;
   oldScores[3] = 40;

   /* Your solution goes here */

   for (i = 0; i < SCORES_SIZE; ++i) {
      cout << newScores[i] <<" ";
   }
   cout << endl;

   return 0;
}

3 0
2 years ago
Read 2 more answers
Which of the following is true? You are a project manager for Laredo Pioneer's Traveling Rodeo Show. You're heading up a project
nika2105 [10]

Answer: C. You are a project manager for Laredo Pioneer's Traveling Rodeo Show. You're heading up a project to promote a new line of souvenirs to be sold at the shows. You're ready to document the processes you'll use to perform the project as well as define how the project will be executed and controlled and how changes will be monitored and controlled. You are working on the project management plan.

Explanation:

4 0
2 years ago
When the condition of an if statement is false, the computer will return an error message to the user.
sp2606 [1]
True is the correct answer
6 0
3 years ago
Read 2 more answers
Why is information so important?
Nata [24]
Information tells us what is going on. Information helps us understand situations better, and how to accomplish some things. For instance, if I told you I lost my ball, you'd be at a blank! What if I told you I lost it in your yard? Now that you have the information you understand the situation better. Information helps us communicate important things.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Spreadshet formula to add totals​
    12·1 answer
  • Draw the cache tables and the state of all bits within them. Suppose you have a 16 byte cache with 2 byte long cachelines that i
    6·1 answer
  • Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a li
    15·1 answer
  • How do you use bold text?
    5·2 answers
  • Which type of network treats all processors equally, and allows peripheral devices to be shared without going to a separate serv
    11·1 answer
  • You have just read about a new security patch that has been made available for your Windows system, so you install the patch as
    6·1 answer
  • Which of the following code displays the area of a circle if the radius is positive? Question 4 options: if (radius &lt;= 0) Sys
    11·1 answer
  • Write a recursive method called lengthOfLongestSubsequence(a, b) that calculates the length of the longest common subsequence (l
    15·1 answer
  • Change the following sentences using 'used to
    12·1 answer
  • How to realize dynamic balance of planar closed-chain leg mechanism?​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!