[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

typedef*

Posted on 1998-12-29
6
Medium Priority
?
487 Views
Last Modified: 2010-04-15
If I have a structure
typedef struct {
   int i;
   int j;
   int k;
} MYSTRUCT;
And I want to declare a type that is a pointer to MYSTRUCT,
which is the preferable way and why (or are these the same)?
typedef MYSTRUCT* PMYSTRUCT;
or
typedef MYSTRUCT *PMYSTRUCT;
Thank You
0
Comment
Question by:marvinm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 5

Expert Comment

by:scrapdog
ID: 1255463
Both styles declare the exact same thing.  I don't see an advantage of one over the other, however

typedef MYSTRUCT *PMYSTRUCT

seems much more common.
0
 
LVL 1

Expert Comment

by:cox
ID: 1255464
same thing, the compiler will make the same thing with both styles.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1255465
Cox:  is that not more or less what I said?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:marvinm
ID: 1255466
scrapdog is correct. Your answers are the same.
I thought that both typdefs should be the same. I have seen it done both ways and was just wondering which was preferable.
scrapdog, if you lock this I will grade your response.
0
 
LVL 5

Accepted Solution

by:
scrapdog earned 200 total points
ID: 1255467
Most people are probably accustomed to seeing

typedef MYSTRUCT *PMYSTRUCT

so maybe this way is preferable to make it easier to read.  However it is entirely up to you.
0
 

Expert Comment

by:sselvi
ID: 1255468
Both the pointer reference is same.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question