FUNCTIONS ? | Sololearn: Learn to code for FREE!



I have started functions in C++ from the very beginning but during the very first lecture i was confused.I was unable to understand anything about functions 😭😭😭 Would you please like to put me on path to functions ? You just have to told me 👇🏻 introduction to functions ? 👇🏻 Definition of function. 👇🏻 declaration of functions. 👇🏻 Function Call 👇🏻 Return type of function . Just Explain Briefly .

6/23/2018 9:45:20 AM

Shehroz Irfan

13 Answers

New Answer


Ok ... the functions is something to make your code simple to read and shortcut the code .... Ok if you want to repeat a code many time you have to make a function for example : (From real life but it thr same as programing) you love coffee and you make coffee every day so you repeat this work ... Ok lets see this function >> void coffee make () { cout << "get coffee"; cout <<"get water"; cout << "put the water on fire"; cout << "add coffee"; cout << "put coffee in cup"; } if you want to repeat these commands many times you just need to call the function many time not to write cout <<"get coffee"; cout <<"get water"; . . . etc so this shortcut alot if you want to repeat it many times to call the function you just need to write the name of the function and (); for example coffeemake (); the computer will do all cout command that i wrote before so you have to define the function before use and out side of the main function .... .. am sorry if i made english mistakes ... am not english man


Christoph Behl thanks 👍


Saurabh Tiwari thank you 👍


Seb TheS got it . thanks 👍


Mohammad Alshareef i got it . excellent. well explained. thanks 👍💚


Designing ?


confused ?

+5 you can refer to this site


shehroz irfan you are welcome.


I don't study C++, but I know very good what are functions in Python. Functions are type of objects, that return a value depending on their arguments. Functions are called as function name followed by a parenthesis pair having comma separated values called arguments. In function definition the values are called parameters rather than arguments, parameters can't be used outside the function definition.


much more simple you can repeat functions in main. reduces code!



Functions are central to C programming and are used to accomplish a program solution as a series of subtasks.