sorcerer_see: (Default)
PS I synthesize here in my own words what King teaches, re-write all his example programs, character by character, solve all the C exercises he hands out, and if I do not understand something fully I use Bermudez' CP: AMA Study Guide to find clarification. I comment to what King teaches cursively. I do not copy-paste anything from the book!

CPaMA 1Ed - Page 025 to 025 - 4.97% Completion

2.8 Layout of a C Program


King describes a C program as a series of 'tokens': groups of characters that together form a meaning and lose it if split. Identifiers, keywords, operators, +, -, punctuation marks, and string literals are all tokens.

printf ("Height: %d\n", height); 

consists of 7 tokens:
(1) printf                 > identifier
(2) (                        > punctuation
(3) "Height: %d\n"  > string literal
(4) ,                        > punctuation
(5) height               > identifier
(6) )                        > punctuation
(7) ;                        > punctuation

In most cases space between tokens is irrelevant. In most cases tokens can be crammed together, unless putting 2 tokens together causes them to merge into a third token. For example in the celsius.c program we could remove most of the empty space, provided we leave space between tokens as float and Fahrenheit.

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:46 am
Powered by Dreamwidth Studios