mardi 30 juin 2015

Code modification for an array of numbers to be read from pointer


I have the following code: value represents an array of numbers. I want to arrange all numbers while also keeping track of the max and min.

if (value > stats_max)
    stats_max = value;
if (value < stats_min)
    stats_min = value;

can I do:

if ((value > stats_min) && (value < stats_max))
     stats_mid = value;

just to print one value.

what should I do to write all those "values" in an array?


Aucun commentaire:

Enregistrer un commentaire