Functions are declared by specifying the function return type (which includes any use of the const qualifier), the name of the function, and the function's argument types enclosed in parentheses (round brackets), which also includes any use of the const qualifier. The declaration ends with a semi-colon. Arguments may also be given default values but if any argument has a default value, all arguments that follow must also have default values.
[const] type name([[const] type [=value][, ...]]);
Declarations may also contain definitions in which case you must include the formal argument names that will be used by the definition. The definition (or implementation) must be enclosed in braces (curly brackets) and the semi-colon must be omitted.
[const] type name([[const] type arg1 [=value][, ...]])
{
statement;
}
Functions must be declared before they can be used. In most cases it is necessary to forward declare functions in a header. In these cases, default values must be omitted from the definition.
Functions that do not return a value must return void. Functions that do not accept arguments must still include the argument parentheses. Use of the void keyword to indicate no arguments is optional. Thus the following declarations are exactly the same (although declaring both in the same program would be invalid):
void f();
void f(void);
As well as the return type and argument types, class member functions (methods) can also be modified with the const qualifier:
struct obj
{
void f(void) const;
};
The const keyword assures the caller that the object's immutable members will not be modified by the function (that is, the internal state of the object's immutable data will remain unaltered). Also, when working with constant objects, only constant methods can be called.
Functions can also be declared static. In the case of external functions, the static keyword limits the visibility of the function to its translation unit. In the case of class methods, static member functions are local to the class as opposed to instances of the class. Static member functions do not have access to an implicit this pointer since they are not associated with any instance of the class but are accessible even when no instances of the class exist.
You cannot call any C++ function/method from C
(but the other way perfectly legal: you can call C from C++)
C++ contains as a subset the C language (almost entirely). I is there fore possible to write a C program to use public member functions <if they are static methods!>, all you do is compile with a C++ compiler.
C++ is picky about type casting, you have to be explicit where with C it is automatic.
Anything declared outside of a function is global.
...a function call.
Every C plus plus program that is a main program must have the function 'main'.
The rand() function returns an integer (int) value that represents a pseudo-random number between 0 and RAND_MAX, RAND_MAX being a constant declared in the run-time library. Each time rand() is invoked, a different value is returned.
to locate coordinates ..
Anything declared outside of a function is global.
There is no such term as "building function" in C++.
...a function call.
yes,we can make function inline
Every C plus plus program that is a main program must have the function 'main'.
Control is returning to the caller of the function.
method
It is the first function that gets called when the program is executed.
It is a quadratic function which represents a parabola.
The rand() function returns an integer (int) value that represents a pseudo-random number between 0 and RAND_MAX, RAND_MAX being a constant declared in the run-time library. Each time rand() is invoked, a different value is returned.
Use function mkdir.
to locate coordinates ..