About Lesson
Pointer Arithmetic
A pointer in c is an address, which is a numeric value. Therefore, you can perform arithmetic operations on a pointer just as you can on a numeric value. There are four arithmetic operators that can be used on pointers: ++, –, +, and –
#include
void main()
{
int a=10;
int *pa;
pa=&a;
printf(“address stored in pa is %d”,pa);
printf(“nvalue referring by pa is %d”,*pa);
pa++;
printf(“nn”);
printf(“address stored in pa is %d”,pa);
printf(“nvalue referring by pa is %d”,*pa);
pa=pa+2;
printf(“nn”);
printf(“address stored in pa is %d”,pa);
printf(“nvalue referring by pa is %d”,*pa);
}