0
Why use other functions when all I've learned so far can easily be done in main?
just a few examples
6 Respuestas
+ 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.
+ 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.
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.
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
0
Creating a function can help you save space and time from having to retype the information when you recall a function.
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