C++ function
Translation results:
C++ is a statically typed, compiled, general-purpose, case-sensitive, irregular programming language that supports procedural programming, object-oriented programming and generic programming.
C++ is considered a mid-level language that combines the features of high-level and low-level languages.
C++ was designed and developed by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill, New Jersey. C++ further extended and improved the C language, originally named C with classes and later renamed C++ in 1983.
C++ is a superset of C. In fact, any legal C program is a legal C++ program.
C++ functionsyntax
A function is a group of statements that together perform a task. Every C++ program has at least one function, the main function main(), and all simple programs can define other additional functions.
You can divide your code into different functions. How you divide your code into different functions is up to you, but logically the division is usually based on each function performing a specific task.
A function declaration tells the compiler the function's name, return type, and parameters. The function definition provides the actual body of the function.
The C++ standard library provides a large number of built-in functions that programs can call. For example, the function strcat() is used to concatenate two strings, and the function memcpy() is used to copy memory to another location.
C++ functionexample
// The function returns the larger of the two numbers int max(int num1, int num2) { // Local variable declaration int result; if (num1 > num2) result = num1; else result = num2; return result; }