Namensräume
Varianten
Aktionen

if statement

Aus cppreference.com
< c‎ | language

 
 
C-Sprache
Allgemeine Themen
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Preprocessor
Kommentare
Keywords
ASCII-Tabelle
Escape-Sequenzen
Geschichte der C
Flusskontrolle
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Bedingte Ausführung Aussagen
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
if statement
Iterationsanweisungen
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Gehe Aussagen
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funktionen
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funktion Erklärung
inline-Spezifizierer
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Specifiers
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cv Planer
Storage-Class-Planer
alignas Spezifizierer (C99)
Literale
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Expressions
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Reihenfolge der Auswertung
alternative Betreiber
Betreiber
Operatorvorrang
Utilities
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
Attribute (C99)
wirft
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inline Montage
 
Bedingt führt Code .
Original:
Conditionally executes code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Dort eingesetzt, wo Code muss nur ausgeführt, wenn eine bestimmte Bedingung vorhanden ist .
Original:
Used where code needs to be executed only if some condition is present.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Syntax

if ( expression ) statement_true
if ( expression ) statement_true else statement_false

[Bearbeiten] Erklärung

expression sind ein Ausdruck, umbaubar zum bool sein .
Original:
expression shall be an expression, convertible to bool.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn es zu true auswertet, wird die Steuerung an statement_true übergeben, statement_false (falls vorhanden) nicht ausgeführt wird .
Original:
If it evaluates to true, control is passed to statement_true, statement_false (if present) is not executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ansonsten Steuerung statement_false übergeben wird, wird statement_true nicht ausgeführt .
Original:
Otherwise, control is passed to statement_false, statement_true is not executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Keywords

if, else

[Bearbeiten] Beispiel

#include <stdio.h>
 
int main()
{
    int i = 2;
    if (i > 2) {
        printf("first is true\n");
    } else {
        printf("first is false\n");
    }
 
    i = 3;
    if (i == 3) printf("i == 3\n");
 
    if (i != 3) printf("i != 3\n");
    else        printf("i != 3 is false\n");
}

Output:

first is false
i == 3
i != 3 is false