×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

interpreting "typedef struct x* y"

interpreting "typedef struct x* y"

interpreting "typedef struct x* y"

(OP)
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.

RE: interpreting "typedef struct x* y"

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
http://home.earthlink.net/~bobbitts

RE: interpreting "typedef struct x* y"

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 :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close