In this post, we will write a C++ program to print the values of the pointer character array

C++ program to print the values of pointer character array


C++ program to print the values of pointer character array.

#include<iostream>
#include<conio.h>

int main()
{
    system("cls");

    char *a[5] = {"Apple","Banana","Orange","Coconut","Mellon"};

    std::cout<<a[0]<<std::endl;
    std::cout<<a[1]<<std::endl;
    std::cout<<a[2]<<std::endl;
    std::cout<<a[3]<<std::endl;
    std::cout<<a[4]<<std::endl;

    getch();
    return 0;
}



Output

Apple
Banana
Orange
Coconut
Mellon