What is the Output? | Bitwise NOT Operator in C Explained |
Автор: 1printf
Загружено: 2025-11-11
Просмотров: 107
Описание:
🧾 Description:
Let’s decode this tricky C program that uses the bitwise NOT (~) operator 👇
Question:
What is the output of the given program?
int main() {
int a = 0xffff;
int b;
b = ~a;
printf("%d\n", b);
}
Options:
a) 65536
b) -65536
c) 0
✅ Correct Answer: b) -65536
Explanation:
0xffff in hexadecimal = 65535 in decimal (all 16 bits are 1).
The ~ operator inverts all bits.
So,
a = 0000FFFF
~a = FFFF0000 (in 32-bit system)
When interpreted as a signed integer, this becomes -65536.
🔑 Keywords:
C bitwise NOT operator, complement operator in C, ~ operator in C, hexadecimal in C, C programming MCQ, bitwise operations explained, signed integer overflow, tricky C questions, #1printf
🏷️ Tags:
#CProgramming #BitwiseOperators #CInterview #CodingShorts #ProgrammingQuiz #LearnC #BinaryLogic #CConcepts #CBitwise #1printf
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: