title: Deleting a pointer which contains a pointer pointing to another location
body: <p>Recently while I was writing code for Stack implementation. I came across this doubt. Please help me get through this. The code is written as shown below.</p>
  
  <pre><code>struct Stack{
    int top;
    int capacity;
    int *array;
  }
  
  Stack* createStack(int capacity){
    Stack *S = new Stack;
  
    S-&gt;capacity = capacity;
    S-&gt;top = -1;
    S-&gt;array = new int[capacity];
  
    return S;
  }
  
  void Delete(Stack *S){
    delete S-&gt;array;
    delete S;
  }
  </code></pre>
  
  <p>Now my doubt lies here in the delete function. As we can see that the S is pointing to a memory block of type Stack. Inside which there is another pointer pointing to an array of blocks of type int.
  <strong>What would happen when the S block is deleted directly without deleting the array block?</strong></p>