title: How to initialize const members of structs on the heap
body: <p>I would like to allocate a structure on the heap, initialize it and return a pointer to it from a function. I'm wondering if there's a way for me to initialize const members of a struct in this scenario:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  
  typedef struct {
    const int x;
    const int y;
  } ImmutablePoint;
  
  ImmutablePoint * make_immutable_point(int x, int y)
  {
    ImmutablePoint *p = (ImmutablePoint *)malloc(sizeof(ImmutablePoint));
    if (p == NULL) abort();
    // How to initialize members x and y?
    return p;
  }
  </code></pre>
  
  <p>Should I conclude from this that it is impossible to allocate and initialize a struct on the heap which contains const members?</p>