#include <stdio.h>
struct data{
void(*hello)();
};
void hello(){
puts("Hello comes from C");
}
int main(){
struct data{
void(*hello)();
};
void hello(){
puts("Hello comes from C");
}
int main(){
// the first way
struct data d;
d.hello = hello;
d.hello();
struct data d;
d.hello = hello;
d.hello();
// the alternate way
struct data dd;
struct data* ptr = ⅆ
ptr->hello = *hello;
ptr->hello();
return 0;
}
struct data dd;
struct data* ptr = ⅆ
ptr->hello = *hello;
ptr->hello();
return 0;
}
No comments:
Post a Comment