Which Arithmetic Operations Can Be Performed on Pointers?

Which Arithmetic Operations Can Be Performed on Pointers?

You can perform a limited number of arithmetic operations on pointers. These operations are: Increment and decrement

Increment and decrement
Increment and decrement operators are unary operators that add or subtract one, to or from their operand, respectively. They are commonly implemented in imperative programming languages. ... The increment operator increases, and the decrement operator decreases, the value of its operand by 1.
› Increment_and_decrement_operators
. Addition and subtraction.

Which operation can be performed on pointers?

The different operations that can be possibly performed on pointers are: Incrementing/Decrementing a pointer. Addition/Subtraction of a constant number to a pointer. Subtraction of one pointer from another.

Can we perform arithmetic operations on pointers?

We can perform arithmetic operations on the pointers like addition, subtraction, etc. However, as we know that pointer contains the address, the result of an arithmetic operation performed on the pointer will also be a pointer if the other operand is of type integer.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.