Chapter    3

C Basics: Statements and Functions

Every programming language is designed to follow strict rules that define the language’s source code structure. The C programming language is no different. These next few chapters will explore the syntax of C. This chapter focuses on two of the primary building blocks of C programming: statements and functions. In a nutshell, a statement tells the computer to do something. A function is a series of statements.

C Statements

A statement in C is very much like a declarative statement in English; it tells the computer to do something. “Say ‘Hello’” and “preheat oven to 350°F” are examples of concise, unambiguous, English statements. Here are two statements in the C language:

printf( "Hello!\n" ); ...

Get Learn C on the Mac: For OS X and iOS, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.