Discussion
Are the expression *ptr++ and ++*ptr are same?
Answer: B
Correct answer: False
They differ in what is incremented. *ptr++ parses as *(ptr++), because the postfix ++ binds more tightly than the unary *: it yields the value currently pointed to and advances the pointer.
++*ptr parses as ++(*ptr): it dereferences first and increments the pointed-to value, leaving the pointer where it was. The first walks along an array reading it; the second modifies one element in place.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development