Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 18035

How can a large function with state variables be broken down into smaller ones?

$
0
0

Should the state variables be passed around as pointers or should tail calls be used?

Method 1:

func() {    ...    foo(&stateVariable1);    bar(&stateVariable1, &stateVariable2);    ... // result using state-variables 1 & 2    return result;}

Method 2:

func() {   ... // foo   return bar(stateVariable1);}

Viewing all articles
Browse latest Browse all 18035

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>