Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interpreting "typedef struct x* y"

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I interpret the following declaration?

typedef struct x* y

Is "x" a dummy variable, such that "y" is defined as a pointer type that points to any type of struct? I ask this because I am trying to reverse engineer some code where "y" is referenced heavily as a variable type, and no other mention of "x" is made in any other headers, etc.
 
y is a synonym for struct x *. IOW:

y myStruct;

would be the same as:

struct x *myStruct;

Are you *sure* that struct x isn't defined anywhere? Maybe you don't have access to the source that defines x, and maybe this was purposeful to hide the implementation details of x.

HTH,



Russ
bobbitts@hotmail.com
 
This code is used to export a structure the programmer don't want to show.


example

c-file:
typedef struct cellCDT { int type; cellCDT *next; } cellCDT;

h-file:
typedef struct cellCDT *cellADT;


When used in this way only the c-file which exports the cellADT can access the internal structure.

I hope the explanation makes sense :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top