title: Assign values to a dereferenced void pointer
body: <p>I'm doing a class in c++ that supports any kind of variable to help me in a future project. The thing is, when I try to assign a value to a <code>void*</code> variable, I get the error: <code>void*</code> is not a pointer-to-object type. Here is the code:</p>
  
  <pre><code>int main (void) {
      void* a;
      int x;
      a = malloc(sizeof(int));
      x = 120;
      ((int)(*a)) = x;
      printf("%d",((int)*a));
      free(a);
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>I see it like I am trying to assign the value of x in the memory block reserved for a. I want that the value stored in x be stored in the memory block of a. Can any1 help me?</p>