© Slobodan Dmitrović 2021
S. DmitrovićModern C for Absolute Beginnershttps://doi.org/10.1007/978-1-4842-6643-4_13

13. Functions

Slobodan Dmitrović1  
(1)
Belgrade, Serbia
 

In short, functions are named reusable pieces of code. A function is made up of a function body associated with a function name. A function can accept zero or more parameters and optionally return a result.

13.1 Introduction

A function has a type, a name, a list of optional parameters, and a function body. The function blueprint is of the following syntax:
some_type function_name(optional_parameters_declarations)
{
      // function body with declarations and statements
      return some_value; // optional return statement
}
So far, we have used only a main() function , which is the main ...

Get Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.