Where we can use the conditional and arry ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Where we can use the conditional and arry ?

C

15th Oct 2020, 8:49 AM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar
4 Answers
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);
16th Oct 2020, 8:25 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 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.
15th Oct 2020, 10:56 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForle, can you give me one example ?
16th Oct 2020, 8:05 AM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar
+ 1
Great. I understand. Thank you. 🙏
16th Oct 2020, 11:15 AM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar