Chapter 4

C Basics: 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.

Chapter 3 discussed some fundamental programming topics, including the process of translating source code into machine code through a tool called the compiler. This chapter focuses on one of the primary building blocks of C programming, the function.

C Functions

C programs are made up of functions. A function is a chunk of source code that accomplishes a specific task. You might write a function that adds together a list of numbers or one that calculates the radius of a given circle. Here's an example:

int ...

Get Learn C on the Mac now with O’Reilly online learning.

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