title: How to determine the total memory allocation?
body: <p>I have gone through a C project to understand some concepts and found the following code.</p>
  
  <pre><code>#define MY_NODE_ALLOC(coffee) ((struct items *)(coffee) + 1)
  
  struct store
  {
    char *name;
    int   id;
  };
  
  struct items
  {
    char *itemName
    char *itemCode;
    int   quantity;
  };
  
  void * allocation(struct store *shop)
  {
    struct items *coffee = malloc(sizeof(struct items) + sizeof(*shop));
    return MY_NODE_ALLOC(coffee);
  }
  </code></pre>
  
  <p>I have the following questions</p>
  
  <ol>
  <li><p>How much total memory is allocated? is it equal to size of <code>*shop</code> and <code>struct items</code>?</p></li>
  <li><p>What is the difference between the 2 statements <code>malloc(sizeof(struct itmes));</code> and <code>malloc(sizeof(*shop));</code></p></li>
  <li><p>What is this macro returning? As per my understanding, adding 1 to pointer is used to jump to next element in array but I do not understand this case.</p></li>
  </ol>