CCCPaste

56c7a85dad1a2

//Q1) Create an structure and demonstrate the use of dynamic memory allocation.
 
#include 
#include
using namespace std;
 
struct dynamic{
    string statement;
    int size;
};
 
int main(){
    
    dynamic* object=(dynamic*)malloc(sizeof(dynamic));

    object->statement="Dynamically allocated memory of size: ";
    object->size=sizeof(dynamic);

    cout<statement<<" "<size<