C Programming Functions

Last modified by Microchip on 2023/11/09 09:06

Functions
Self contained program segments designed to perform a specific, well-defined task.

Function schematic

All C programs have one or more functions. The main() function is required in every C program and it is from within it that all other functions are called. The purpose of most functions is to process information passed to it by the part of the program that called it, though some functions take no parameters at all.

Functions in C are conceptually like an algebraic function from math class.

Functions in C are conceptually like an algebraic function from math class

If you pass a value of 7 to the function: f(7), the value 7 gets copied into x and used everywhere that x exists within the function definition: f(7) = 72 + 4*7 + 3 = 80.