QP School
Pointer arithmetic in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Pointer arithmetic in C (/showthread.php?tid=5092)



Pointer arithmetic in C - Qomplainerz - 07-25-2023

Pointers can be manipulated using arithmetic operations.

int numbers[] = {10, 20, 30, 40, 50};
int *ptr = numbers;

printf("%d\n", *ptr); // Output: 10
ptr++; // Move the pointer to the next element
printf("%d\n", *ptr); // Output: 20