title: Implicit Declaration of Function sbrk( )
body: <p>I am trying to create my own malloc function, and I did not finished yet. Here is related part of my code:</p>
  
  <p><code>mymalloc.h</code> :</p>
  
  <pre><code>#pragma once
  
  #include &lt;stdlib.h&gt;
  
  typedef struct METADATA{
      struct METADATA *next;
      struct METADATA *prev;
      int free;
      size_t size;
  }METADATA;
  
  METADATA *metadata;
  
  void *mm_malloc(size_t size);
  </code></pre>
  
  <p><code>mymalloc.c</code></p>
  
  <pre><code>#include "mm_alloc.h"
  #include "stdlib.h"
  #include "stdio.h"
  
  void *mm_malloc(size_t size) {
      if(size == 0)
          return NULL;
  
      METADATA *tmp;
      long address;
  
      if(metadata == NULL){
          sbrk(sizeof(tmp));
          sbrk(size);
          address = sbrk(0);
  
          return (void *)address;
      }
  }
  </code></pre>
  
  <p>In the <code>sbrk(sizeof(tmp));</code> part of <code>mymalloc.c</code>, I got <code>"Implicit declaration of function sbrk()"</code>. What I wanted to do ise creating a place for <code>metadata</code> of new block and also a place for the required size. Where am I doing wrong?</p>