4. Is the following program correct? If not, please correct it (4) #include<iostream> using namespace std; int main () { int size; int * ptr; cin>>size; ptr=new int [size]; for ( int count=0; count<size; count++) { ptr[count]=count*count; cout<<ptr[count]<<" "; } return 0; }
4. Is the following program correct? If not, please correct it (4) #include<iostream> using namespace std; int main () { int size; int * ptr; cin>>size; ptr=new int [size]; for ( int count=0; count<size; count++) { ptr[count]=count*count; cout<<ptr[count]<<" "; } return 0; }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
4. Is the following
#include<iostream>
using namespace std;
int main ()
{
int size;
int * ptr;
cin>>size;
ptr=new int [size];
for ( int count=0; count<size; count++)
{
ptr[count]=count*count;
cout<<ptr[count]<<" ";
}
return 0;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images