control statements in c l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Control Statements in C PowerPoint Presentation
Download Presentation
Control Statements in C

Loading in 2 Seconds...

play fullscreen
1 / 16

Control Statements in C - PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on

Control Statements in C. C Keywords. auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Control Statements in C' - yovela


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
c keywords
C Keywords

auto double int struct

breakelse long switch

case enum register typedef

char extern return union

const float short unsigned

continuefor signed void

defaultgoto sizeof volatile

doif static while

The words in bold print are used in control statements. They

change the otherwise sequential execution of the assignment

statements in a function block

assignment statement
assignment statement

aResult = 10;

aResult = countB;aResult = (aValue + 100) / countD;aResult = sqrt (aValue);

block of statements
block of statements

{constint MAX_BINS = 11;int orderNumber;int binNumber;printf("Enter order number: ");scanf("%d", &orderNumber);binNumber = orderNumber % MAX_BINS;printf("Bin number is %d\n", binNumber);}

simple if statement
simple “if” statement

if (aNumber != 1000) countA++;

if with a block of statements
“if” with a block of statements

if (aValue <= 10){ printf("Answer is %8.2f\n", aValue); countB++;}// End if

if else with a block of statements
“if” – “else” with a block of statements

if (aValue <= 10){ printf("Answer is %8.2f\n", aValue); countB++;}// End ifelse{ printf("Error occurred\n"); countC++;}// End else

nested if statement
nested “if” statement

if (aValue == 1) countA++;elseif (aValue == 10) countB++;elseif (aValue == 100) countC++;else countD++;

while with a single statement
“while” with a single statement

while (aResult >= 1000) aResult = aResult / aValue;

while with a block of statements
“while” with a block of statements

while (aResult >= 1000) { aResult = aResult / aValue; printf("Result is %9.4f\n", aResult); } // End while

while with nested if statements
“while” with nested “if” statements

aResult = MAX_VALUE;

while (aResult >= 1000) { countW++;// nested if statementif (aValue == 1) countA++;elseif (aValue == 10) countB++;elseif (aValue == 100) countC++;else countD++; aResult = aResult / aValue; } // End while

while performing an infinite loop
“while” performing an infinite loop

while (1) { receiveFrom (aClient, aRequest); theResults = processRequest(aRequest); sendTo (aClient, theResults); } // End while

for with a single statement
“for” with a single statement

for (i = 1; i <= MAX_LENGTH; i++) printf("#");

for with a block of statements
“for” with a block of statements

for (i = 0; i < MAX_SIZE; i++) { printf("Symbol is %c\n", aBuffer[i]); aResult = aResult / i; } // End for

for performing an infinite loop
“for” performing an infinite loop

for (;;) { receiveFrom (client, request); results = processRequest(request); sendTo (client, Results); } // End for

switch statement
“switch” statement

switch (aNumber) {case 1 : countA++;break;case 10 : countB++;break;case 100 :case 500 : countC++;break;default : countD++; } // End switch