C if…else Statement

C if statement

if (testExpression) {   // statements}

The if statement evaluates the test expression inside the parenthesis.

If the test expression is evaluated to true (nonzero), statements inside the body of if is executed.

If the test expression is evaluated to false (0), statements inside the body of if is skipped from execution.

Flowchart of if statement

C if…else statement

The if…else statement executes some code if the test expression is true (nonzero) and some other code if the test expression is false (0).

Syntax of if…else

if (testExpression) {    // codes inside the body of if}else {    // codes inside the body of else}

If test expression is true, codes inside the body of if statement is executed and, codes inside the body of else statement is skipped.

Flowchart of if…else statement

Nested if…else statement (if…elseif….else Statement)

The if…else statement executes two different codes depending upon whether the test expression is true or false. Sometimes, a choice has to be made from more than 2 possibilities.

135,797 thoughts on “C if…else Statement

  1. Do you have a spam problem on this blog; I also am a blogger, and I was wondering your situation; we have developed some nice methods and we are
    looking to exchange techniques with others, please shoot me
    an email if interested.

  2. Thank you so much for giving everyone such a memorable opportunity to discover important secrets from this site. It is always so great and full of a lot of fun for me and my office peers to search the blog at the least three times every week to read through the fresh stuff you will have. Not to mention, I’m so at all times happy considering the fantastic information you give. Certain 3 tips on this page are unequivocally the best we have all had.

  3. Excellent post. I used to be checking constantly this weblog and I am inspired!
    Very helpful information specially the final phase 🙂 I maintain such information a lot.
    I was looking for this particular info for a very lengthy
    time. Thank you and good luck.

  4. I simply wished to say thanks yet again. I’m not certain the things that I would have created without the entire points shown by you on such a field. It has been a traumatic matter for me personally, but being able to view a new professional way you managed that forced me to weep with joy. I’m grateful for the advice and even hope you know what a powerful job you are doing training others thru your webpage. I am certain you haven’t met any of us.

  5. Hello there! I could have sworn I’ve been to this site before but after checking through some
    of the post I realized it’s new to me. Nonetheless,
    I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!

  6. [url=http://prednisolone365.us.org/]prednisolone medicine[/url] [url=http://genericventolin.company/]generic ventolin[/url] [url=http://celebrex.recipes/]celebrex[/url] [url=http://tenormin.us.com/]tenormin[/url] [url=http://strattera.us.org/]cheap strattera[/url] [url=http://serpina.us.com/]buy serpina[/url] [url=http://honey-tea.com/]aciclovir[/url] [url=http://nolvadex.club/]nolvadex pct[/url] [url=http://amitriptyline.club/]discover more[/url] [url=http://propecia.irish/]propecia[/url] [url=http://buycialis.club/]buy cialis[/url] [url=http://prednisolone.wtf/]prednisolone 5 mg[/url] [url=http://lasix.irish/]purchase lasix online[/url] [url=http://buyclindamycin.us.org/]clindamycin[/url] [url=http://albuterol.wtf/]albuterol[/url] [url=http://buylasix.ooo/]lasix[/url] [url=http://seroquel.us.org/]seroquel 400 mg[/url]

  7. Woah! I’m really loving the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s challenging
    to get that “perfect balance” between superb usability and appearance.
    I must say you’ve done a awesome job with this.
    Also, the blog loads super fast for me on Firefox.
    Outstanding Blog!

Leave a Reply

Your email address will not be published.