C examples for Pointer:Array Pointer
Access the Out-of-Bounds Array Elements
#include <stdio.h> int main()//from w w w. j av a 2s. co m { int num[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; int *ipt1, *ipt2; ipt1 = &num[5]; ipt2 = &num[6]; printf("Current value of *ipt1: %d\n", *ipt1); printf("Current value of *ipt2: %d\n", *ipt2); ipt1 = ipt1 - 2; ipt2 = ipt2 + 3; printf("Now current value of *ipt1: %d\n", *ipt1); printf("Now current value of *ipt2: %d\n", *ipt2); ipt1 = ipt1 - 15; ipt2 = ipt2 + 22; printf("Now current value of *ipt1: %d\n", *ipt1); printf("Now current value of *ipt2: %d\n", *ipt2); return(0); }