Functions are named blocks of code that perform actions and are executed when called by name. There are two types of functions: user-defined functions written by programmers and built-in functions that are part of the language, such as sqrt(), pow(), rand(), and clock(). Functions provide a modular way to structure programs by dividing program logic into smaller subroutines. User-defined functions consist of a function declaration, which defines the name and parameters, and a function definition, which contains the code. Functions can return a single value using the return statement, with the return type specified in the function declaration.