Monday, 15 June 2015

c - which one is good practice: using block of code in main or making function of same code? -


Actually what should I know if I should use the function often for short codes or put it in. Like

  Main () {// Something like (condition) i ++; // This is the code for which I want to make a function}   

or I should use it like this

  zero incrementi () {i ++; Return; } Main () {// Something}   

Which method is good, readable, or good practice in a nutshell?

In this situation, the code is being done only by a condition and increment, Do not advise to write, but whenever you need to, revert the line of code. If you have more instructions, you are advised to make a function to call each time, then reuse the part of the code

No comments:

Post a Comment