Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver3
26いいね 1081回再生

If statements are easy! 🤔

#coding #programming #cprogramming

00:00:00 numbers
00:06:10 booleans
00:09:08 check if string is empty

// if statement = Do some code if a condition is true.

// EXAMPLE 2

bool isStudent = true;

if(isStudent){
printf("You are a student");
}
else{
printf("You are NOT a student");
}

// EXAMPLE 3

char name[50] = "";

printf("Enter your name: ");
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = '\0';

if(strlen(name) == 0){
printf("You did not enter your name");
}
else{
printf("Hello %s", name);
}

コメント