Question
Download Solution PDFWhich of the following is a unary operator in C?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFExplanation:
Unary Operators in C
A unary operator takes a single operand and applies the operation to it. For example, the increment operator (++) increases the value of its operand by one, while the decrement operator (--) decreases the value of its operand by one. Unary operators are essential in programming for tasks like loop control, value manipulation, and memory management.
Types of Unary Operators in C:
- Increment Operator (++): Increases the value of its operand by one. It can be used in both prefix (++i) and postfix (i++) forms.
- Decrement Operator (--): Decreases the value of its operand by one. It can also be used in both prefix (--i) and postfix (i--) forms.
- Unary Plus (+): Although it doesn’t change the value of its operand, it indicates that the operand is a positive number. It is rarely used in practice.
- Unary Minus (-): Negates the value of its operand, effectively changing its sign.
- Logical NOT (!): Inverts the truth value of its operand, turning true into false and vice versa.
- Bitwise NOT (~): Inverts each bit of its operand, turning 0s into 1s and 1s into 0s.
- Address-of Operator (&): Returns the memory address of its operand.
- Indirection Operator (*) or Dereference Operator: Accesses the value stored at the memory address pointed to by a pointer variable.
- Size of Operator: Returns the size, in bytes, of its operand.
- Typecast Operator: Converts a variable from one data type to another.
Last updated on Jun 7, 2025
-> RRB JE CBT 2 answer key 2025 for June 4 exam has been released at the official website.
-> Check Your Marks via RRB JE CBT 2 Rank Calculator 2025
-> RRB JE CBT 2 admit card 2025 has been released.
-> RRB JE CBT 2 city intimation slip 2025 for June 4 exam has been released at the official website.
-> RRB JE CBT 2 Cancelled Shift Exam 2025 will be conducted on June 4, 2025 in offline mode.
-> RRB JE CBT 2 Exam Analysis 2025 is Out, Candidates analysis their exam according to Shift 1 and 2 Questions and Answers.
-> The RRB JE Notification 2024 was released for 7951 vacancies for various posts of Junior Engineer, Depot Material Superintendent, Chemical & Metallurgical Assistant, Chemical Supervisor (Research) and Metallurgical Supervisor (Research).
-> The selection process includes CBT 1, CBT 2, and Document Verification & Medical Test.
-> The candidates who will be selected will get an approximate salary range between Rs. 13,500 to Rs. 38,425.
-> Attempt RRB JE Free Current Affairs Mock Test here
-> Enhance your preparation with the RRB JE Previous Year Papers.