+ 2

When is it worth to create function in C?

Is it a good practice to create function in C for every block of code that you need to evaluate more than once in your programm? Or maybe it is a wasting of memory and sometimes you can just copy some loops without creating function? I don't know how functions influence on the machine productivity.

25th Jan 2019, 5:33 AM
Vladislav Riabets
Vladislav Riabets - avatar
3 ответов
+ 7
i'm choosing the functions. it's better for readability, scalability and if you call them with pointers you gain at memory usage in some scenarios.
25th Jan 2019, 6:27 AM
notqueued
notqueued - avatar
+ 4
Yes, make a function whenever you might need to repeat the same block of code.
25th Jan 2019, 6:25 AM
James
James - avatar
+ 2
Just two previous threads which can be referenced for the same query. https://www.sololearn.com/Discuss/96352/?ref=app https://www.sololearn.com/Discuss/1663409/?ref=app
25th Jan 2019, 9:36 AM
Hatsy Rei
Hatsy Rei - avatar