[c language] When statement conditional interpretation question.

Asked 2 years ago, Updated 2 years ago, 30 views

//168

int main() { int arr[10] = {100,98,97,95,89,76,92,96,100,99}; int* parr = arr;
int sum = 0;

while(parr - arr <= 9) 
{   
    sum += (*parr);    
    parr ++;   
} 
printf ("Mean of my test score: %d \n", sum/10);   
return 0; 

}

while(parr - arr <= 9) 
{   
    sum += (*parr);    
    parr ++;   
} 

I'd like to know how to interpret the conditional expression in that while sentence.

c

2022-09-22 20:18

1 Answers

Looking at C's operator priority , arithmetic operations have higher priority than relational operations. This means that the weir block code is executed when the result of parr-arr is less than or equal to 9.


2022-09-22 20:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.