Develop a C program to create an array of pointer with strings.

Code

#include <stdio.h>

int main() {
// array of pointers
char *cityPtr[4] = {
"Chennai",
"Kolkata",
"Mumbai",
"New Delhi"
};
// temporary variable
int r, c;
// print cities
for (r = 0; r < 4; r++) {
c = 0;
while(*(cityPtr[r] + c) != '\0') {
printf("%c", *(cityPtr[r] + c));
c++;
}
printf("\n");
}
return 0;
}

Output