Write a C++ Program to Access Elements of an Array Using Pointer

C++ Program to Access Elements of an Array Using Pointer

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C++ programming concepts. You can learn C++ language at your own speed and time. One can learn concepts of C++ language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

C++ Program to Access Elements of an Array Using Pointer
C++ Program to Access Elements of an Array Using Pointer

Write a C++ Program to Access Elements of an Array Using Pointer

PROGRAM:C++ Program to Access Elements of an Array Using Pointer

/* C++ Program to Access Elements of an Array Using Pointer*/

#include <iostream>
using namespace std;

int main()
{
int data[5];
cout << “Enter elements: “;

for(int i = 0; i < 5; ++i)
cin >> data[i];

cout << “You entered: “;
for(int i = 0; i < 5; ++i)
cout << endl << *(data + i);

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *