title: Are void * pointers meant for generic typing in C?
body: <p>I often see void pointers being cast back and forth with other types of pointers and wonder why, I see that malloc() returns a void pointer that needs to be cast before used also.</p>
  
  <p>I am very new to C and come from Python so pointers are a very new concept to wrap my head around.</p>
  
  <p>Is the purpose of the void * pointer to offer some "dynamic" typing?</p>
  
  <p>Take this code as example, is it valid code?</p>
  
  <pre><code>struct GenericStruct{
      void *ptr;
  };
  
  // use void pointer to store an arbitrary type?
  void store(struct GenericStruct *strct, int *myarr){
      strct-&gt;ptr = (void *) myarr;
  }
  
  // use void pointer to load an arbitrary type as int*?
  int *load(struct GenericStruct *strct){
      return (int *) strct-&gt;ptr;
  }
  </code></pre>