#include /* Illustrates the syntax and potential pitfalls of a simple if statement. */ void main (void) { /* Example 1. The condition is true. */ if (2> 1) { printf("Statement one\n"); printf("Statement two\n"); } /* Example 2. The condition is false. */ if (1> 2) { printf("Statement three\n"); printf("Statement four\n"); } /* Example 3. Putting a semicolon after the condition. */ if (1> 2); { printf("Statement five\n"); printf("Statement six\n"); } /* Example 4. Forgetting the braces. */ if (1> 2) printf("Statement seven\n"); printf("Statement eight\n"); }

AltStyle によって変換されたページ (->オリジナル) /