Pointer arithmetic involves operations like incrementing (ptr++), decrementing (ptr–), or adding/subtracting integers to/from pointers. These operations move the pointer forward or backward in memory by a number of bytes equal to the size of the data type it points to.
For example, incrementing an int* pointer moves it by 4 bytes (on most systems, where an int is 4 bytes). This makes pointer arithmetic very useful for navigating through arrays without using traditional indexing.
Syntax:
int *ptr;
ptr++; // Moves to the next integer location in memory
This technique helps improve performance in certain situations, especially when working with large data sets.