Invalid Operations
Explore invalid operations on pointers in C, including why multiplication and adding two pointers are not allowed. Understand how subtraction works only between pointers of the same type to determine element differences in memory.
We'll cover the following...
We'll cover the following...
Introduction
There are a few operations that are invalid and don’t make sense on pointers:
- Multiplication and division between pointer and number or pointer and pointer.
- Addition of two pointers.
- Subtraction between two pointers of different types.
These operations are not allowed because they don’t make sense.
Multiplication
Adding a constant value to a pointer makes sense because we know that we move x ...