Conditional Operator in C - C Programming Tutorial 29

preview_player
Показать описание
Notes for You:: Conditional Operator in C - C Programming Tutorial 29
- is the only ternary operator in C.

- It accepts 3 operands.
(operand1) ? operand2 : operand3;
Where:
operand1: must be a condition
operand2: value1 // true part
operand3: value2 // false part

Ex: C Program to find the given number is even or odd.

#include <stdio.h>
int main()
{
int num = 10;
printf("%d is %s\n", num, (num%2==0)? "even" : "odd"); // 10 is even
return 0;
}

Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.

=========================================

Follow the link for next video:

Follow the link for previous video:

=========================================

C Programming Tutorials Playlist:

=========================================
Watch My Other Useful Tutorials:-

Computer Programming Fundamentals Playlist:-

C Practical LAB Exercises Playlist:-

C++ Tutorials Playlist:

=========================================

► Subscribe to our YouTube channel:

► Visit our Website:

=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
Рекомендации по теме
Комментарии
Автор

Answer the following questions: Let's see who gives the best answer
1. Explain conditional operator in C

ChidresTechTutorials