sorcerer_see: (Default)
PS I synthesize here in my own words what K&R teach, re-write all their example programs, character by character, solve all the C exercises they hand out. I comment to what K&R teach cursively. I do not copy-paste anything from the book! In regards to the percentages listed: books often have prefaces with Roman numbers and often also lengthy Appendices. In my calculation I include all pages that I effectively study and synthesize.

TCPL 2Ed - Page 014 to 015 - 7.16% Completion

1.4 Symbolic Constants


Magic numbers
need to be avoided in C. C Programmers call numbers 'magic' numbers if it is not clear what they mean or what their purpose is.

One method to clarity numbers in your program:
- #define defines 'symbolic names' or 'symbolic constants' to be a string of characters:

#define      name      replacement text

Rules for #define
- the name can have letter and numbers but must begin with a letter (just like variable names). The replacement text can be any sequence of letters and/or numbers.

After such a definition has been made, in case of any occurrence of the name that has been defined,  but not when in quotes or as part of another name, the name will automatically be replaced by the defined replacement text

k-r_exp-15-1.c


k-r_exp-15-1.out


LOWER, UPPER and STEP, in this program, are symbolic constants, not variables, and therefor are not listed under declarations. To distinguish them they are written in capitalized format. At the and of a #define line there is no semicolon.

Profile

sorcerer_see: (Default)
sorcerer_see

October 2025

S M T W T F S
    12 34
56 7 8 9 10 11
12 1314 15 16 1718
19 2021 22 23 2425
2627 28293031 

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 16th, 2026 05:49 am
Powered by Dreamwidth Studios