ConceptStep · learning platform for computer science

Bug Hunt: find, explain, fix

C programming · Lesson

C · lesson 26 / 27

Bug Hunt: find, explain, fix

Learn to distinguish a program that does not compile from one that compiles but produces the wrong result.

1 · Observe and predict

The concept

A compilation error prevents the program from starting; a logical error passes the compiler but violates the specification. Finding both requires diagnostics and targeted tests.

Mental model:

specification → reproduce the bug → inspect output/diagnostics → locate the line → fix → rerun the same test

2 · Flowchart First

Follow the same algorithm as a flowchart

Use Start and Step: when the active block changes, ConceptStep also highlights the C lines representing that same step.

Loading flowchart…
3 · Flowchart ↔ C · Run in Page

Lab 1 — Run the example program

Run C executes only the example shown on the left, using stdin on the right. The coding challenge below has a separate editor and test button.

Bug Hunt: fixed version Start the flowchart to synchronize the code
                        1#include <stdio.h>
                        2 
                        3int main(void)
                        4{
                        5    int voto;
                        6    scanf("%d", &voto);
                        7 
                        8    if (voto >= 60)
                        9        printf("SUFFICIENTE\n");
                        10    else
                        11        printf("INSUFFICIENTE\n");
                        12 
                        13    return 0;
                        14}
Ready. Make a prediction before running.

                    
                

Lab 2 — Coding challenge: write your code — Fix the boundary

Fix the buggy program: score 60 passes. Read integer; print OK if >=60, otherwise NO.

This is a different program from lab 1. Complete the starter code: Check all test cases compiles this editor and tests every input, including boundary cases.

4 · Guided practice

Check your prediction

The specification says 60 is a pass. Which correction also makes boundary value 60 pass?

Challenge 1 / 5 · Understanding

Progress: 0 / 5 · correct: 0

Your competency map

What you need to know for Bug Hunt: find, explain, fix

ConceptStep separates what is required from what is recommended or useful as reinforcement. Only required prerequisites block your progress.

Current topic Strong skill Review due Needs reinforcement To be mastered Optional support

Relationships: solid line = required · dashed line = recommended · dotted line = reinforcement.

GUIDED LEARNING PATHS

Want to choose the next skill to develop?