CSC_Test_2_Study_Guide_1

CSC_Test_2_Study_Guide_1 - - switch (a) { case 1: //if true...

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

View Full Document Right Arrow Icon
FLOW OF CONTROL * while statements will be conditionally executed 0 or more times. * do while statements will be conditionally executed 1 or more times. - do{ b += 1; } while(a < b); * for statement - for( i = 0; i < 10; i++) - the value of the counter after the loop is exited is valid and can be tested or used. - some parts of the expression can be missing - for( ; i < 10; ) - it is legal to modify the index counter in the body of the loop. * break statement terminates the execution of the enclosing for, while, do, or switch. * continue statement bypasses 1 iteration of the innermost for, while, do, or switch. * switch statement
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: - switch (a) { case 1: //if true fall through case 2: break; //stop falling through default: }- the default case will always evaluate to TRUE- if no conditions are TRUE, and there is no default, nothing gets executed.- if you want to stop falling through, use a break statement.- case statements can only check for equality with an integer constant. * goto statement- add symbolic labels (label : ) - if(a &lt; b) goto s1; else goto s2; s1 : do something s2 : do something- avoid using gotos except for global exits * Conditional operators c = (a &lt; b) ? d : e; equal to: if(a &lt; b) c = d; else c = e;...
View Full Document

This note was uploaded on 04/28/2009 for the course CSC 230 taught by Professor Freeh during the Spring '08 term at N.C. State.

Page1 / 2

CSC_Test_2_Study_Guide_1 - - switch (a) { case 1: //if true...

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

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