C-Selection - ECE 175: Introductory C for Engineers...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 175: Introductory C for Engineers Selection Structures: if and switch Statements
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 175: Introductory C for Engineers - Selection Structures: if and switch Statements Control structures Control the flow of execution in a program C control structures Enables combining of individual instructions into a single logical unit The logical unit has one entry point and one exit point Three kinds of control structures Sequence, selection, and repetition Sequence A compound statement written as a group of statements bracketed by { and } So far, we have been seeing only this kind Choose alternative statements by testing the value of a variable Such statements are called "conditional" statements Establishes a criterion for either executing or skipping a group of statements 2
Background image of page 2
ECE 175: Introductory C for Engineers - Selection Structures: if and switch Statements Relational and equality operators Most conditions we employ will be of the following form Relational and equality operators 3 variable operator variable_or_constant Operator Meaning Type < less than relational > greater than relational <= less than or equal to relational >= greater than or equal to relational == equal to equality != not equal to equality
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 175: Introductory C for Engineers - Selection Structures: if and switch Statements Sample conditions Sample data x = -5 power = 1024
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/03/2008 for the course ECE 175 taught by Professor Grubbs during the Spring '08 term at University of Arizona- Tucson.

Page1 / 13

C-Selection - ECE 175: Introductory C for Engineers...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online