//============================================================================ // Author : Sven Gothel // Copyright : 2022 Gothel Software e.K. // License : MIT // Description : C++ Lesson 0.1 Functions //============================================================================ #include #include /** * Lesson 0.1 Functions * * This lesson demonstrates * - function declaration and definition in same or different modules */ /** * Function declaration with function name `add`. * * No program code is given. * * A function declaration is used to let the compiler * know how to use a function. * * @param x int paramter 1 * @param y int paramter 2 * @return type int */ int add(const int x, const int y); /** * Function definition with function name `add` * and given program code. * * A function definition must match a given function declaration, if exists. * * A function definition may be called if invoked. * * @param x int paramter 1 * @param y int paramter 2 * @return type int */ int add(const int x, const int y) { return x + y; } // Include header file, which contains declaration of function `double_value` as defined in module module_lesson01.cpp. // Linker has to link lesson01_function.o + module_lesson01.o to resolve this function! #include "cpp_basics/module_lesson01.hpp" int main(int argc, const char* argv[]) { // A loop to print all program invocation arguments { for(int i=0; i