float mean_so_far(int val) { static int sum, number; /*Statics are set to zero initially*/ sum = sum + val; number++; return sum / number; }
Because there is only one instance of each of the stsic variables. It would be necessary to define a different version of the function, with a unique name, for each stream to be recorded. This weakness was one of the reasons for the extension into the use of objects.