title: C/ C++ basic struct not working Visual studio
body: <p>I have 2 simple structs and one has array of the second one. </p>
  
  <p>When accesing the second one my program crashes in visual studio but not in codeblocks.</p>
  
  <p>So one line is not working and another one is.</p>
  
  <p>Can somebody explain why?</p>
  
  <pre><code>    struct buffer {
      uint64_t size;
      void* data;
  
  };
  
  struct list_of_buffers {
      uint64_t number_of_buffers;
      bool* active_buffers;
      struct buffer* array_of_buffers;
  }buffer_list;
  
  
  
  
  void alloc_fun(int size){
     buffer_list.array_of_buffers = (struct buffer*)calloc(0, sizeof(struct buffer) * size);
  
     //this one makes my program crash
     buffer_list.array_of_buffers[0].data = NULL;    
  
     //this one doesnt
     struct buffer tmp = buffer_list.array_of_buffers[0];
     tmp.data = NULL;
     }
  </code></pre>
  
  <p>Can somebody explain please?</p>