Hi all,
I was going through a piece of code which had a very
interesting format. There were two files: one was a .h file, and the
other was a .c file. The .c file had a structure defined in it which
was typedef'ed in .h file.
what I observered was even more interesting: I was allowed
to declare objects of structure that was typedefed in the header file,
but I could not use any of the members of the structure outside the .c
file which delcared it. Every time I did that, I got error:
"dereferencing pointer to incomplete type".
Why is it so that I was not allowed to access the members
but I was allowed to use structure definition in calls to malloc()?
does this problem exists because the structure definition was not
available in the header file? Or is this a neat trick to hide the
structure members?
Please clarify me on this issue. Thanks in advance for your
help.
Madhav.