0
What this fuction returns
struct cube *create_cube(void) { return (struct cube *) calloc(1, sizeof(struct cube)); } main(){ cube = create_cube(); }
4 Réponses
+ 2
It seems the function returns a pointer to a cube structure, casted from what was initially a void pointer allocated by calloc(), the size of memory allocated was enough to fit the size of one cube structure, the cube structure definition however, is non present.
The main method is missing its return type, and inside it, the type of <cube> is undefined, could be it was declared somewhere else, but initialized in main.
Hth, cmiiw
+ 1
I don't know about this thanks for pointing this
0
thanks
0
could you give me an example of this