Develop a C program to create an array of pointer with strings.
Code
#include <stdio.h>int main() {// array of pointerschar *cityPtr[4] = {"Chennai","Kolkata","Mumbai","New Delhi"};// temporary variableint r, c;// print citiesfor (r = 0; r < 4; r++) {c = 0;while(*(cityPtr[r] + c) != '\0') {printf("%c", *(cityPtr[r] + c));c++;}printf("\n");}return 0;}
Output
0 Comments
Post a Comment