YOUR C LEARNING COMPANION

Find your next idea.

Learning path
Before CChapter 1 of 73

What is programming?

Turn an everyday problem into precise steps, and distinguish a program, an algorithm, and the result you want.

6 min readFoundationsComputing concepts
Offline reading
In this chapter9 sections
0% through this chapter

Programming means describing what you want a computer to do. We will start with an everyday problem, then turn it into clear steps. You do not need an editor or any coding experience yet.

1. Begin with the problem

Imagine buying three meals at 40 rupees each. The total is 120 rupees. A program for this task also needs rules for other cases: zero meals, an invalid quantity, or a price that has changed. Start with the ordinary case, then decide what the boundaries mean.

A goal says what you want: calculate a bill. A specification adds rules we can check. Which quantities are allowed? Which price should be used? What happens if the total is too large? Answering these questions makes the task precise enough to test.

2. An algorithm describes a method

An algorithm is a precise method for solving a kind of problem. Our billing method could be: read the quantity, check it, multiply by the price, and report the result. We can discuss these steps in ordinary language. C is one language in which we could express them.

  1. Problem
  2. Precise method
  3. Program
  4. Observed result
A design-and-checking model, not a claim that every program is a single straight sequence.

A program expresses the work in a programming language. It also runs within an environment, such as a laptop operating system. The algorithm may say “compare two quantities.” The C program must choose suitable types and write a comparison that follows C rules.

3. Precision is about shared rules

Computers do not need instructions to be “simple” in the human sense; they need a form the system knows how to process. A short instruction can trigger a large amount of work. What matters is that each stage has rules. Ambiguous instructions such as “use a reasonable quantity” require someone to decide what reasonable means. A program cannot reliably substitute your unstated intention for a missing rule.

The recipe analogy helps: order and conditions matter. Its limit is that a person following a recipe can infer missing context, choose a substitute, or notice a smell. Ordinary C code does not acquire those abilities just because its author expected a particular outcome. Even software that uses a learned model still runs within programmed interfaces and assumptions.

4. Data connects the problem to the program

A quantity, a price, a name, and an image are all information, but they may call for different representations. Data is information represented in a form a system processes. The same stored pattern can have different meanings under different rules. A future chapter will distinguish values, objects, names, and types; for now, notice that choosing a representation is part of solving the problem.

For this first bill example, whole rupees keep the arithmetic simple. A real payment system would need deliberate choices about smaller units, rounding, limits, and invalid input. A teaching example is useful because it isolates an idea. Its simplifications should be named rather than silently treated as a complete real-world design.

5. A program can run and still be wrong

Syntax means the rules for forming the code. Semantics means what that code does. A compiler can catch many syntax and type mistakes. It cannot generally know that your bill needed multiplication when you wrote addition. Successfully building a program is one check; meeting the task’s requirements is another.

Checking a program means comparing its behavior with its specification. Examples help uncover mistakes, but a few successful runs do not establish correctness for every input. Reasoning about limits and assumptions is as much a part of programming as typing code. Debugging improves that understanding rather than replacing it.

6. How to use CodedileRead

Begin with “Before C,” then read “C foundations.” You can understand the first explanations without running code. Use deeper notes when you want more detail, and revisit a definition whenever a later idea feels unclear. The thought checks have freely available explanations; they do not lock the next chapter.

Use Codeweek when you want complete program walkthroughs and CodedileFAQs for specific questions. Here, “marked as read” is your bookmark in the journey, not a certificate of mastery. The default technical baseline is C17; examples or differences that specifically require C23 are labeled. An operating-system convention is identified separately from a language guarantee.

Think it through

A program adds 40 and 3 and displays 43. It translated successfully. Is it correct for the meal-bill specification?

Read the explanation

No. Valid syntax and a successful run do not satisfy a specification that requires multiplying the price by the meal count. The intended result for these inputs is 120.

Primary references and further reading

Before you move on

  • A specification states the allowed inputs, required results, and failure rules.
  • An algorithm describes a method; a program expresses work in a language.
  • A successful build does not establish that the program solves the intended problem.
Keep these ideas separate
Syntax / Correctness
Valid syntax is one requirement. Correctness also depends on the task and the behavior for its allowed cases.
Explain it in your own words

How would you describe the rules for a canteen bill before writing any C?

Optional: say it aloud or keep a note. You can continue whenever you are ready.

Check your understanding

Optional. Answers are not saved or sent, and reading stays unrestricted.

Why does a program need precise instructions?
Read the explanation for every choice
  1. The computer follows specified operations, so missing decisions must be made explicit.

    ✓ Correct reasoning. A program needs rules for the situations it handles; an unstated intention is not an instruction.

  2. The computer always guesses the programmer’s intention.

    A programmer’s intended meaning does not replace the language’s rules.

  3. Precise instructions make every program correct.

    Precision helps express a plan, but the plan can still contain a mistake.

General

Quick reference from the earlier edition

This compact reference keeps existing links and saved passages available. Read the expanded lesson above for the full context.

Reading convention: Unless a version is named, explanations use the C17 rules (largely the same language features as C11). C23 differences are identified explicitly. Complete example programs use C99-or-later features and can be compiled as C17. Short declarations and statement fragments illustrate a rule; supply the necessary headers, declarations, and enclosing function before compiling them. Platform examples are not guarantees of the C standard.

C is one of computing's most influential languages. Developed in the early 1970s, it became central to operating systems, embedded software, and performance-sensitive libraries. C++ grew directly from C; languages such as Java borrowed much of its syntax. Python has a different language design, while its widely used CPython implementation is written mainly in C. Efficiency, portability, and access to low-level facilities explain C's continuing importance.

This report provides a comprehensive exploration of the theoretical aspects of C, beginning with its origin and evolution, and progressing through its lexical structure, compilation process, and the complete set of language keywords. It delves into the semantics of each keyword, the role of comments, preprocessors, macros, and header files, and examines the standard library, primitive types, type qualifiers, storage classes, operators, control flow, functions, pointers, arrays, structures, dynamic memory, I/O, file handling, command-line arguments, and the critical issues of undefined and implementation-defined behavior. The report also addresses portability, concurrency, memory models, safety, diagnostics, debugging, coding standards, and best practices, concluding with a collection of illustrative code snippets to solidify understanding of C's core logic.

Ready for the next idea?

Mark this chapter as read whenever you feel ready.

CHAPTER 01 / 73

In this chapter

What is programming?

Search all 73 chapters in both languages.EN + HG

Try “pointer”, “why int”, or “undefined behavior”.

Concepts connect. Follow your curiosity.↑ ↓ to explore · Enter to open
MAKE YOURSELF COMFORTABLE

Your reading space

Appearance

A clear canvas with balanced contrast.

Text size

100%
AA

Reading tools

Your data stays in this browser

Export a backup before changing browsers or replacing an older version of the reader.

YOUR PERSONAL MARGINS

My notebook

Saved on this device
A LITTLE CLARITY

The glossary

A starting meaning, then a chapter to go deeper.

A QUICK DEFINITION

A little clarity

Read the full explanation →

A thought worth keeping