Disqus Shortname

Sunday, August 16, 2015

Program: Array of int Pointer



#include <stdio.h>

const int MAX = 3;

int main() {

int var[] = { 10, 100, 200 };
int i, *ptr[MAX];

for (i = 0; i < MAX; i++) {

ptr[i] = &var[i]; /* assign the address of integer. */
}

for (i = 0; i < MAX; i++) {

printf("Value of var[%d] = %d\n", i, *ptr[i]);

}

return 0;
}

/*-via Programming Hub for Android, a top rated Programming App on Google Play

https://play.google.com/store/apps/details?id=com.freeit.java*/


No comments:

Post a Comment