Question:

Given below are two statements :
one is labelled as
Assertion (A) and the other is labelled as
Reason (R).
Assertion (A) :
++*ptr in C increments the value pointed by ptr.
Reason (R) :
ptr is a pointer.
In the light of the above statements, choose the most appropriate answer from the options given below :

Show Hint

Unary operators go Right-to-Left! ++*ptr means increment the value. If you wanted to increment the address, you'd use *++ptr.
Updated On: Aug 6, 2026
  • Both (A) and (R) are correct and (R) is the correct explanation of (A)
  • Both (A) and (R) are correct but (R) is not the correct explanation of (A)
  • (A) is correct but (R) is not correct
  • (A) is not correct but (R) is correct
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept:
• Pointers store the memory address of another variable.
• The dereference operator \((*)\) accesses the value stored at that address.
• The pre-increment operator \((++)\) increases the value of its operand.

Step 1:
Analyze the expression \(++*ptr\) using operator precedence
In C, both \(*\) and prefix \(++\) have the same precedence and associate from right to left.
• \(*ptr\) is evaluated first: It fetches the value at the address held by ptr.
• \(++\) is then applied to that fetched value: It increments the actual data stored in that memory location. So, if ptr points to an integer \(5\), after this operation, that integer becomes \(6\). Thus, (A) is true.

Step 2:
Evaluate the Reason (R)
For the expression \(*ptr\) to be valid and to allow dereferencing, the variable ptr must indeed be declared as a pointer type. If it were a regular integer, the compiler would throw an error. Thus, (R) is true.

Step 3:
Determine the relationship
The fact that ptr is a pointer is the reason we can apply the dereference operator, which in turn allows the increment operator to reach and modify the target value. Thus, (R) is the underlying reason for (A).
Was this answer helpful?
0
0

Top CUET PG Data Science A.I Cyber Security and Computer Sci. Questions

View More Questions

Top CUET PG Programming and Data Structures Questions

View More Questions