Is this an example of DMA too?
CODE:
#include
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n] = {};
for(int i=0; i<n; i++){
cin>>arr[i];
}
for(int i=0; i<n; i++){
cout<<arr[i];
}
return 0;
}
Is this an example of DMA too?
CODE:
#include
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n] = {};
for(int i=0; i<n; i++){
cin>>arr[i];
}
for(int i=0; i<n; i++){
cout<<arr[i];
}
return 0;
}
No its not an example of dynamic memory allocation
But I am allocating space according to the input, right? So why not?