Pointer Arithmetic in C - Pointer Arithmetic
Learn C - C tutorial - pointer arithmetic in c - C examples - C programs
Pointer Arithmetic in C - Pointer Arithmetic
- Pointer arithmetic is one of the ways to travel across through an array.
- It is more common in the C world of programmers.
- Most faculties at UWB dosen't want to see pointer arithmetic in your coding.
Learn C - C tutorial - pointer arithmetic in c - C examples - C programs
Sample Code
#include <stdio.h>
int main()
{
int arr[]= {10,20,30,40,50};
int *ptr=arr;
printf("Value: %d, Memory Address: %p\n",*ptr,ptr);
++ptr;
printf("Value: %d, Memory Address: %p\n",*ptr,ptr);
++ptr;
return 0;
}
Output
Value: 10, Memory Address: 0x7ffe3eac5bd0
Value: 20, Memory Address: 0x7ffe3eac5bd4