-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab3_1.cpp
More file actions
18 lines (16 loc) · 704 Bytes
/
Lab3_1.cpp
File metadata and controls
18 lines (16 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace std;
int main()
{
int *ptr;
ptr = new int; //creation of integer block dynamically using new operator in c++
*ptr = 3;
float *ptr1;
ptr1 = new float; //creation of float block dynamically using new operator in c++
int *ptr2;
ptr2 = new int[4]; //creation of integer array dynamically using new operator in c++
delete ptr; //deletion of dynamically created block which was referred by ptr using delete operator
delete ptr1; //deletion of dynamically created block which was referred by ptr1 using delete operator
delete ptr2; //deletion of dynamically created array which was referred by ptr2 using delete operator
return 0;
}