So let's start with
As an alternative toCode:const int MAX_NEURONS = 10; neurontype neurons[MAX_NEURONS]; for ( i = 0 ; i < MAX_NEURONS ; i++ ) evalneuron(neurons[i]);
Now, changing the first one to process 20 neurons is as simple as changing 10 into 20.Code:neurontype n1,n2,n3,n4,n5,n6,n7,n8,n9,n10; evalneuron(n1); evalneuron(n2); evalneuron(n3); evalneuron(n4); evalneuron(n5); evalneuron(n6); evalneuron(n7); evalneuron(n8); evalneuron(n9); evalneuron(n10);
Changing the first one to process a number specified by the user at runtime is very easy.
Doing either of these things with the second code involves massive code edits in the first instance, and is basically impossible in the second.



2Likes
LinkBack URL
About LinkBacks



