C NOT logical operator !

preview_player
Показать описание
C NOT ! logical operator tutorial example explained

#C #NOT #!

// logical operators = ! (NOT) reverses the state of a condition

bool sunny = false;
bool subscribed = true;

if(!sunny){
printf("\nIt's cloudy outside!");
}
else{
printf("\nIt's sunny outside!");
}

return 0;
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>
#include <stdbool.h>

int main(){

// logical operators = ! (NOT) reverses the state of a condition

bool sunny = false;
bool subscribed = true;

if(!sunny){
printf("\nIt's cloudy outside!");
}
else{
printf("\nIt's sunny outside!");
}

return 0;
}

BroCodez
Автор

Nobody can explain logical operators like bro!

provokator-provocateur
Автор

bro helped me more then my professor lmao

chrisathanasi
Автор

Seems that the first option of the if statement triggers if true and second statement triggers if result is false

CusPedro
Автор

Lol, its funny how the first video of the playlist have 15000.

boom
Автор

Great Explanantion. I want to become a fellow bro.

siddharthjain
Автор

i wish he taught swift, things become simpler in his lessons

nomadeducator
Автор

here's some code I made:

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

int main(){
bool runningProperly = true;
bool hungary;
char userInput;
printf("Are you hungary? (Y|N)\n");
scanf("%c", &userInput);
userInput = toupper(userInput);
switch(userInput){
case 'Y':
hungary = 1;
break;
case 'N':
hungary = 0;
break;
default:
printf("Please only answer with 'Y' and 'N'");
runningProperly = 0;
break;
}
if(runningProperly){
if(!hungary){
printf("Ok, I will bake you something later.");
}
else{
printf("Ok, I will whip something up for you right away!");
}
}
}

PSIwolf