+ 1
Where we can use the conditional and arry ?
C
5 odpowiedzi
0
Saying you want to print "pass" when the score is higher than 6 out of 10, you can use:
if(score >= 6)
puts("pass");
And you can use array to store every students' score. Like we can define a scores array.
int scores[] = {10, 3, 9, 0, 1, 3, 5};
And string is a character array like:
char message[] = "Pass";
We then can change the condition part to:
if(score >= 6)
puts(message);
+ 1
You can use array if you want to save a bunch of data, and in C a char array can be represented as a string.
You use condition when you want to do something when it's true and do other things or nothing when it's not.
+ 1
CarrieForle, can you give me one example ?
+ 1
Great. I understand. Thank you. 🙏