Small Definition About FUNCTIONS In C++

in #c7 years ago

download.png

A function is a group of statements that together perform a task. Every C++ program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.

FUNCTION VOID :
The void type, in several programming languages derived from C and Algol68, is the type for the result of a function that returns normally, but does not provide a result value to its caller. Usually such functions are called for their side effects, such as performing some task or writing to their output Parameters

MEANING OF VOID :
void literally means nothing. It is usually used as a function or method return type, when the function isn't supposed to return anything. In the second method you typed out, with the void keyword, it is setting a value, and nothing needs to be returned.

USE OF int main In C++ :
The short answer, is because the C++ standard requires main() to return int . As you probably know, the return value from the main() function is used by the runtime library as the exit code for the process. Both Unix and Win32 support the concept of a (small) integer returned from a process after it has finished.

Sort:  

Followed n upvoted u do d same to me
No18 in d website jassim

Congratulations @hunnandanger! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment
You got a First Reply
Award for the number of upvotes
Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.23
TRX 0.21
JST 0.036
BTC 97780.60
ETH 3397.25
USDT 1.00
SBD 3.25