C++ Syntax Question:

What is functions Syntax in C++?

Tweet Share WhatsApp

Answer:

Functions that a programmer writes will generally require a prototype. Just like a blueprint, the prototype tells the compiler what the function will return, what the function will be called, as well as what arguments the function can be passed. When I say that the function returns a value, I mean that the function can be used in the same manner as a variable would be. For example, a variable can be set equal to a function that returns a value between zero and four.

For example:
#include <cstdlib> // Include rand()

using namespace std; // Make rand() visible

int a = rand(); // rand is a standard function that all compilers have</cstdlib>

Download Basic C++ Syntax PDF Read All 27 Basic C++ Syntax Questions
Previous QuestionNext Question
What is do..while loops structure?How to defines the function in C++?