#include <stdio.h>
int main() {
// declaring an array and a loop variable.
int a[] = {10, 20, 30, 40}, i;
// because 'a' behaves like an array and
// stores an address, copy the address into
// a pointer p.
int *p = a;
// use p to traverse the array a. the syntax
// remains the same.
for (i = 0; i < 4; i++) {
printf("%d\n", p[i]);
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: