Why use other functions when all I've learned so far can easily be done in main? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Why use other functions when all I've learned so far can easily be done in main?

just a few examples

25th Jun 2016, 9:03 PM
Dantor_King
Dantor_King - avatar
6 Respostas
+ 2
when the programa grows, you need to organize things. this is where multiple files come in place, and put related code in each of them. you better have 20 files with 500 lines each than a single 10000 line file.
25th Jun 2016, 9:40 PM
Garme Kain
Garme Kain - avatar
+ 1
it's not necessary to make other functions but it if you make function then it is easy for you to find debug code error and for you and other it is easy to understand and you can use it as much as you can and it can divide your program problem into individual modules.
26th Jun 2016, 2:36 AM
gandhiyash
0
The making of functions is not strictly necessary, but when you have to write the same code more than one time with The only difference in The variables used they are very useful. Plus a piece of code written using functions is far more readable than an "all MAIN" code, and is easier to debug.
26th Jun 2016, 10:03 PM
Simone ā€œPilots2013ā€ Giordano
Simone ā€œPilots2013ā€ Giordano - avatar
0
if you use header files in which you have saved your function codes it will make your complier feel easy and tha your presentation of code will be awesome and also if u need to correct or upgrade something you can very easily do it by just choosing the header file which is outdated ,but if you are only using main function it will make your code look too huge and when you need to update something then you need to go through every single line and also your compilation will take too much time in this case
3rd Jul 2016, 12:13 PM
harsh wardhan
harsh wardhan - avatar
0
Creating a function can help you save space and time from having to retype the information when you recall a function.
3rd Jul 2016, 4:24 PM
Enith Sadler
Enith Sadler - avatar
0
I you have typed a code to find the area of a triangle. In some other part of the code if you want to calculate the area of another triangle then you will think of a way to avoid retyping the same code. In such a case you can uae a function and call it wherever required
5th Jul 2016, 6:00 AM
ProHacker Gitesh
ProHacker Gitesh - avatar