Hello dear, to write afunction in C++, you follow the following syntax:
returnValue functionName(parameters){
// your code here...
}
Below there is an example:
int calculateSum(int num1, int num2) {
return num1+ num2;
}asked 1 year ago
1 Answers
16 Views
I am in a situation where I need to use functions in C++, but I don't know what is the exact syntax of writing functions, so please help me out.
Hello dear, to write afunction in C++, you follow the following syntax:
returnValue functionName(parameters){
// your code here...
}
Below there is an example:
int calculateSum(int num1, int num2) {
return num1+ num2;
}