in Unknown Category edited by
465 views
0 votes
0 votes

$\text{prtdata}$ is a pointer to a data type. The expression $^*\text{prtdata}++$ is evaluated as (in C++)

  1. $^*(\text{prtdata++})$
  2. $(^*\text{prtdata})++$
  3. $^*(\text{prtdata})++$
  4. Depends on compiler
in Unknown Category edited by
by
465 views

1 comment

Post increment is higher priority than dereference operator.

So it evaluated as *(ptrdata++).

it should be option 1.

0
0

2 Answers

1 vote
1 vote

Post-increment (++) has higher precedence than dereference (*). Hence it increments the address that the pointer holds, then dereferences it

answer will be *(ptrdata++)

by
0 votes
0 votes
++ and * are unary operators and they have same precedence. The order of evaluation is judged by associativity.

They have right to left associativity so ptrdata ++ is evaluated first then * is applied.  

Ans is 1)*(ptrdata++)
by
Answer:

Related questions