> 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.
------------------------ 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=4949
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/
Re: (PT) query about typedef and pointers
Fernando Arturo G�mez Flores Thu, 30 Dec 2004 23:07:12 -0800
- Re: (PT) Re: about increment ashwin mittal
- Re: (PT) Re: about increment deo sharma
- Re: (PT) Re: about increment ashwin mittal
- Re: (PT) Re: about increment Kanaga Durga
- RE: (PT) Re: about increment Paul Herring
- (PT) query about typedef and pointer... Muthu Kumaran
- Re: (PT) query about typedef and... Fernando Arturo G�mez Flores
- Re: (PT) query about typedef... anand chavali
- Re: (PT) query about typedef... anand chavali
