Hi,
As someone already said.....
typedef is to just decrease ur typing effort...
say i have a structure like
struct MYSTRUCTUREDEFINITION
{
--- Fernando Arturo G�mez Flores
<[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi guys,
> >
> >
> > I have some doubt about Typedef and Swpping
> pointers..
> >
> > Why we r using typedef for stucture...Ex.
> >
> > typedef struct muthu{
> > int a;
> > int b;
> > }good;
> >
> > void main()
> > {
> > good *a1;
> >
> > a1= (good*) mallloc(muthu);
> >
> > }
> >
> >
> > My question is y we are using typedef for structre
> is there any particular
> use?
> >
> >
> > 2. How we can swap the pointer variable without
> third variable;
> >
> For your question 1, as far as I know, in pure C,
> the complete type of your
> structure is "struct muthu". Hence if you want to
> use it in a function,
> you'll have to declare the parameter as struct
> muthu:
>
> void anyFunction(struct muthu* pParam)
> {
> // whatever
> }
>
> If you use a typedef, then you get a strongly typped
> shortcut:
>
> typedef struct muthu good;
>
> void anyFunction(good* pParam)
> {
> // whatever
> }
>
> Now, recall the "strongly typped" phrase. Although
> they have the same size
> and members, they are different types.
>
> Regards,
> Fernando Gomez.
>
>
>
>
>
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~->
To unsubscribe : [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To reply to this message, go to:
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4959
Please do not reply to this message via email. More information here:
http://help.yahoo.com/help/us/groups/messages/messages-23.html
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/