Execute this sample:
/********************Start***********************/

#include <stdio.h>
struct xyz
{
        int a;
        int(*sum)(int a , int b);
};

int sum (int x , int y);
void main()
{
        struct xyz  obj;
        obj.a = 5;
        obj.sum = sum;
        obj.sum(5,10);
}


int sum (int x , int y)
{
        printf("Test\n");
        return 1;
}

/***********************End *********************/

regds
vinay



--- Mark Van Peteghem <[EMAIL PROTECTED]>
wrote:

> 
> What you say applies only to C++. He asked if it was
> possible in C.
> -- 
>   Mark Van Peteghem
>   http://www.q-mentum.com -- easier and more
> powerful unit testing
> 
> 
> umesh rawat wrote:
> 
> > yes certainly u can ..
> > remember that the difference in a structure and a
> > class is that in structure default
> access-specifier is
> > public whereas in a class the default
> access-specifier
> > is private..
> > u certainly can create a function in a structure
> and
> > even declare its objects.
> > --- math sanjeevkumar <[EMAIL PROTECTED]>
> wrote:
> >
> > >
> > > I want to know whether we can declare a function
> in
> > > a
> > > structure in C language and if is so how to use
> > > this.
> 
> 
> 
> 
> 



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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=3642
    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/
 



Reply via email to