avidya

joined 4 days ago
[–] avidya@programming.dev 2 points 2 days ago* (last edited 2 days ago) (2 children)

Did you know that

	int history[10] = {0,0,0,0,0,0,0,0,0,0};  

is the same thing as

        int history[10] = {0};

And an idom in C would be to define a constant for the size like this

enum { HISTORY_MAX = 10};
int history[HISTORY_MAX] = {0};
int history_limit = HISTORY_MAX;