Thanks for you reply.
So if I understood well then I cannot access from main the members of the structure. If I DON'T want to include the statement you proposed into main I can still write a function in my .c and .h file which prints those members and call it from main. This should work, correct?
Thanks.

I believe you understand correctly. Your proposition will work: see the accessor suggestion below for it will be more versatile.

The way you have your code, main will not be able to see the struct member.
Since it is a pointer and you know what is inside of the struct, the 'int sign' is first, you could cast the pointer to an int*. This would only work if the int was at the beginning, by providing the struct {foo;}; c automatically knows the offset of each different member in a struct.

Code:

HNum *n1 = HNum_alloc();
printf("%i",(int*)n1);
HNum_free(n1);

In order to access a subsidiary of a struct you must have the structure definition somewhere in that file. By putting it in the header file the c preprocessor will add that to your main c file. If you don't want to put the struct definition in the header you can also just write the struct definition again in the main file (it doesn't have to be the same inside either). If you flat out don't want to let main know what's inside of the struct you will have to provide what in OO would be called an accessor function to get the value of that struct member.
such as:

Code:

(In the file where you have the HNum_alloc())
int getsign (struct *_HNum)
{
return _HNum->sign;
}

In c however, you would usually just allow everyone to see the struct definition.