answersLogoWhite

0

A unary operator is one that requires only one operand. The unary operators are the prefix and postfix increment and decrement, positive and negative, logical and bitwise negation, and address and indirection operators, plus the words alignof, typeof, and sizeof.

The first two operators are increment "++", and decrement "--". Its position before or after the variable determines prefix or postfix. Incrementing increases the stored value by 1, and decrementing decreases the stored value by 1. If it is to the left of the variable, the operation occurs before the variable is used; if it is to the right, it occurs after the variable is used.


The positive operator "+" simply asserts the current value, and exists as acomplementto the negation operator "-". The negation operator returns the number with the opposing sign. If x is 5, then -x is -5, and if x is -5, then -x is 5.


The logical negation "!" and bitwise negation "~" operators perform actions on individual bits. C considers zero to be false, and all other values to be true. Using logical negation, it returns true if the value is zero, or false for any other value. The bitwise negation changes all 1 bits to 0 bits, and 0 bits to 1 bits. For an unsigned byte, ~0 becomes 255, and ~255 becomes 0. For signed variables, ~0 would become -1, and ~-1 would become 0. This is because of the two's complement method of signed numbers.


Address "&" and indirection "*" operators take the address or value of the operand. The address operator allows a variable to be passed by reference; modifying the reference will modify the original value. Using the indirection operator treats a variable as a memory address, which allows the programmer to access a specific spot in memory.


Alignof, sizeof, and typeof are all used to determine the alignment, size, and type of objects dynamically. This is necessary when trying to determine how data is laid out when there may be differences in memory accesses across platforms (e.g. when reading a ZIP file's directory contents).

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Explain the all operator the c language?

Visit this link http://www.cplusplus.com/doc/tutorial/operators/


Explain the categories of PHP Operators in web technology?

There are arithmetic operators (+, -, %, ++, etc.), comparison operators (<, ==, >=, !=, etc.), logical operators (&&, !, , etc.), assignment operators (=, *=, %=, +=, etc.), conditional operator (?:). The order of operations is unary (!, ++, --), multiplicative (left to right; *, /, %), additive (left to right; +, -), relational (left to right; <, <=, >, >=), equality (left to right; ==, !=), logical and (left to right; &&, and), logical or (left to right; , or), conditional (?:), assignment.


How can find a friend's address in Stockholm in Sweden.?

If you know their Christian and Surname then phone the long distance operator and ask for 'information.' When you explain the situation most operators will give you the address.


1 Explain different types of hazards in brief?

operator prcedence in vb hazard


What is the Java logical operators that has the highest order of preference?

"The following" doesn't make sense if you don't include a list. You can find a list of Java operators, including their precendence, at http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html. Or search for [java operator precedence] for additional places that explain this topic.


Explain the role of sizeof operator in java?

There is no sizeOf() operator in Java.


I have an address in Gothenburg Sweden how do I find out who lives at this address?

If you know their Christian and Surname then phone the long distance operator and ask for 'information.' When you explain the situation most operators will give you the address.


Explain how objects are created in Java?

with new operator


Does 5 x and x 5 represent the same expression explain?

It is difficult to tell. Limitations of the browser used by Answers.com means that we cannot see most symbols. There is no operator between the 5 and x (or x and 5). It is therefore impossible to give a proper answer to your question. Please resubmit your question spelling out the symbols as "plus", "minus", "equals" etc. Different operators will give different answers.


Can you explain the usage of the XOR symbol in Boolean logic and how it differs from other logical operators?

The XOR symbol in Boolean logic represents the exclusive OR operation, which is true only when one of the inputs is true, but not both. This differs from other logical operators like AND and OR, which have different truth conditions.


Which group of people did huck try to explain to Jim spoke a different language then americans?

French


What are the different types of bit operators Explain with help of example for one bit operator?

The most commonly used ones are AND, OR, XOR (exclusive OR). As an example, if A = 6 (binary 110), and B = 4 (binary 100), the bitwise AND operation will compare each corresponding bit, and result in binary 100 (decimal 4). This can be used to check whether a specific bit, in variable A in this case, is equal to one or zero.