User Tools

Site Tools


c:control_structures:else
click
to support this page (eg 0,42 € or so) Thanks.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:control_structures:else [2013/01/17 23:40]
Daniel Gohlke created
c:control_structures:else [2013/01/22 22:02] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +===== else =====
 +
 +<code c>
 +#include <stdio.h> /* including standard library */
 +//#include <windows.h> /* uncomment this for Windows */
 +
 +    if ( condition == true ){
 +    command;    
 +    } else {
 +       command;
 +    }
 +</code>    
 +===== C Sourcecode Example =====
 +
 +<code c>
 +#include <stdio.h> /* including standard library */
 +//#include <windows.h> /* uncomment this for Windows */
 +
 +
 +int main( void )
 +{
 +  int i;
 +
 +  for (i=0;i<=99;i++){
 +    if (i==42) {
 +        printf("I have found the answer: %i\n",i);
 +    } else {
 +           printf("found any other answer\n");
 +           }
 +}
 +
 +return 0;
 +}
 +
 +</code>
 +
 +    output of else
 +    
 +    found any other answer
 +    found any other answer
 +    I have found a answer: 42
  
advertising

Impressum