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 membe
If you insist on keeping the const in the structure, you are going to have to do some casting to get around that:
int *cheat_x = (int *)&p->x; *cheat_x = 3;