in Unknown Category edited by
1,013 views
0 votes
0 votes

The associativity of which of the following operators is Left to Right, in C++?

  1. Unary Operator
  2. Logical not
  3. Array element access
  4. addressof
in Unknown Category edited by
by
1.0k views

1 comment

0
0

5 Answers

1 vote
1 vote

LR - Left to Right

RL - Right to Left

Array element access is Left to Right.

0 votes
0 votes
All 4 option operators associativity is right to left

(1) Unary operator means + or -. Associativity of these operators are right to left

(2) Logical NOT bitwise complement associativity is right to left

(3) Array element access means dereference operator also associativity right to left

(4) Address of operator also has associativity right to left
0 votes
0 votes
(1) Unary Operator    right to left      

(2) Logical Not: right to left

(3) Array Element Access: left to right (highest precedence)

(4) address of (&): right to left

option 1,2 and 4 have equal precedence.

option 3 has the highest precedence among above.

2 Comments

any link

what 3 is actually?

Is it brackets?
0
0

 Shrestha I'm taking as array subscript a[ ]

If it is dereference operator which is *a then all are right to left associativity

0
0
0 votes
0 votes

Here we are converting a binary number to octal that is we are converting a number from base 2 system to base 8 i.e. 2 3.

Hence we have to take every 3 digits from least significant bit and convert it to octal form. 

for the given number 1011101011. Taking every 3 digits from LSB , we get 001 | 011 | 101 | 011   (we have appended 2 zeros at the beginning). Now 001=1; 011=3; 101=5; 011= 3. Hence answer is 1353 in octal 

Answer:

Related questions