Code Snippets »
C/C++ Code Snippets
C++ program to declare read and print dynamic integer array
By: Priya Kaushal On 23 DEC 2016
Here, we will learn how to declare, read and print dynamically allocated array?
A dynamic array declares by new operator and deletes by delete operator.
Here we will read total number of elements, read total elements and print them.
Consider the following program:
using namespace std;
cout<<"Enter total number of elements:";
cout<<"Input "<<n<<" elements"<<endl;
cout<<"Input element "<<i+1<<": ";
cout<<"Entered elements are: ";
Enter total number of elements:5
Input 5 elements
Input element 1: 10
Input element 2: 20
Input element 3: 30
Input element 4: 40
Input element 5: 50
Entered elements are: 10 20 30 40 50
Most viewed pages
C Tips and Tricks
- My personal website.
Keywords (like Linux, Java, Oracle etc) used in this website are the trademarks of their respective owners/company. This website is not affiliated to any company. The tutorials are designed by includehelp Team with the help of well known books and other online resources. These Tutorials are free for all, for learning purposes only. Enjoy learning:)
Copyright © 2015 - 2016. All Rights Reserved.