Functions
Functions
Functions are C++ entities that associate a sequence of statements (a function body) with a name and a list of zero or more function parameters.
// function name: "isodd" // parameter list has one parameter, with name "n" and type int // the return type is bool bool isodd(int n) { // the body of the function begins return n % 2; } // the body of the function ends
When a function is invoked, e.g. in a function-call expression, the parameters are initialized from the arguments (either provided at the place of call or 登录查看完整内容