CHAPTER 06 / 26

C Constants

Learn how to create values that should not change during program execution.

01 — Syntax

const data_type NAME = value;

02 — Example

#include <stdio.h>

int main() {
    const int DAYS = 7;
    printf("Days = %d", DAYS);
    return 0;
}

03 — Important Points

04 — Common Mistakes

05 — Real-World Use

Constants are useful for configuration values, limits and fixed application settings.

06 — Practice

Create a small program that demonstrates the main idea of C Constants.

▶ Try It Yourself← PreviousNext →All Chapters