C – If Else , Switch, Decision Making

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/c-if-else-switch-decision-making/
PINTEREST
PINTEREST
INSTAGRAM

C Programming Tutorial Index

  1. Introduction To Programming
  2. C Setup Development Environment
  3. C Hello World and Compile First Application
  4. C Syntax and Basics
  5. C Variables
  6. C Numeric Variable Types (Integer, Long, Float)
  7. C String Variables
  8. C Constants and Define Processor
  9. C Operators
  10. C If Else and Switch Case Conditionals
  11. C While Loops
  12. C For Loops
  13. C Arrays
  14. C Functions
  15. C Structure
  16. C Union
  17. C File Operations (Open, Read, Write)
  18. C Pointers
  19. C Type Casting
  20. C Header Files and Include

Conditions or Decisions making is one of the most important aspect of programming languages. Actual programming logic is implemented in the decisions. According to decisions the application will be branched and expected results or operations will be accomplished. There are 3 main decision making mechanisms. We will look in details below.

If

The syntax of if is like below in C programming language.

with if(boolean_expression) if boolean_expression is true code block of if which is specified as statements_to_execute is executed. If boolean_expression is not true statement_to_execute code block is skipped without executing. Let’s make an example to make things more clear and understandable.

If Else

If else is similar to the if . Else is executed if if is not executed because of boolean_expression .

If Else if

Up to now we have only evaluated two condition with if and else . But in real world there will be more than two conditions to check. In this situation if ... else if ... can be used.

Switch Case

Switch case is alternative to if statement . Their functionality is very similar. Expressions is evaluated for each case statement. Matched case statements will be processed. For a single expressions more than one case conditions can be matched.

LEARN MORE  Linux Bash If-Else Conditionals

C Programming Tutorial Index

  1. Introduction To Programming
  2. C Setup Development Environment
  3. C Hello World and Compile First Application
  4. C Syntax and Basics
  5. C Variables
  6. C Numeric Variable Types (Integer, Long, Float)
  7. C String Variables
  8. C Constants and Define Processor
  9. C Operators
  10. C If Else and Switch Case Conditionals
  11. C While Loops
  12. C For Loops
  13. C Arrays
  14. C Functions
  15. C Structure
  16. C Union
  17. C File Operations (Open, Read, Write)
  18. C Pointers
  19. C Type Casting
  20. C Header Files and Include
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/c-if-else-switch-decision-making/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)