+ 4
What are functions
language
9 ответов
+ 6
Function is a Group of statements that perform a task
Example :
void hi(string x) {
string name = x;
cout << "Hello my name is " << x << endl;
}
int main() {
hi("Mizuki"); // call the function
hi("Kazane"); // call the function
hi("Yuzuki"); // call the function
return 0;
}
And the outputs is:
Hello my name is Mizuki
Hello my name is Kazane
Hello my name is Yuzuki
+ 5
thanks very much to everyone that responded to my question, learning it bit by bit 😘
+ 4
A typical function consists of its return value type, its name, one or more parameters (including their types), and its body (block of code, including return statement).
A function's body is a block of code written for a purpose, it has a certain functionality (hence function), it may process inputs through its arguments, and return the result to its caller (a code that invoked the function), much like you pass flour, yeast & butter (arguments) to a baker (function), and get a bread (return value), had a baker been a function : )
Hth, cmiiw
+ 3
Sure, ^_^
i am glad i can help...
+ 2
A block of code that can be reused as many times as you want
+ 2
if we talk about the functions than we simply say that it is a collection of statement. which are executed when we call it .....
+ 2
A function is a group of statements that together perform a task.
+ 1
blocks of codes that can be declaced within a scope and can be reused (calling funtion)