tobblitz tobblitz - 13 days ago 6x
C Question

creating variable that change

This is part of my code:

float score_from_judge(number_judges, n)
float judge_score;
printf("Score from judge %d? ", n);
scanf("%f", &judge_score);


int main(void)
int n;
float judge_score;
for(n; n<=number_judges; n++ ) {
judge_score = score_from_judge(number_judges, n)

I am looking for a way to save judge_score in a variable every time score_from_judge returns the value.
I am trying to find a way to make a new variable for each loop.

For example, first time I recieve judge_score it is saved in variable_1 and next time in variable_2 etc.


declare a float array and set its value inside the 'for' loop, as shown:

int main(){
    float judge_score[10];
    for(int n=1; n<=number_judges; n++ ) {
        judge_score[n] = score_from_judge(number_judges, n);