Declaration (computer programming)

[1] Declarations are most commonly used for functions, variables, constants, and classes, but can also be used for other entities such as enumerations and type definitions.

Starting with Java 8, the lambda expression was included in the language, which could be viewed as a function declaration.

A declaration is often used in order to access functions or variables defined in different source files, or in a library.

For variables, definitions assign values to an area of memory that was reserved during the declaration phase.

While a variable or function may be declared many times, it is typically defined once (in C++, this is known as the One Definition Rule or ODR).