Ternary Operator in C Explained - freeCodeCamp

文章推薦指數: 80 %
投票人數:10人

Programmers use the ternary operator for decision making in place of longer if and else conditional statements. The ternary operator take ... Search Submityoursearchquery Forum Donate Programmersusetheternaryoperatorfordecisionmakinginplaceoflongerifandelseconditionalstatements.Theternaryoperatortakethreearguments:ThefirstisacomparisonargumentThesecondistheresultuponatruecomparisonThethirdistheresultuponafalsecomparisonIthelpstothinkoftheternaryoperatorasashorthandwayorwritinganif-elsestatement.Here’sasimpledecision-makingexampleusingifandelse:inta=10,b=20,c; if(a



請為這篇文章評分?