ratednitesh
ratednitesh

Reputation: 258

function pointer used in struct in C

Could anyone explain the following syntax of code for structures in C ?

struct { 
  Fn *pmq;
}
service_MQ[] = 
{
   NULL
   #define BUILd_SVC_MQ(name , func) , (Fn*) Func
   #include<mqsvctable.h>
};

Upvotes: 2

Views: 108

Answers (1)

Mohit Jain
Mohit Jain

Reputation: 30489

  • There is a structure with only member as a pointer (possibly to a function)
  • There is an x-header file mqsvctable.h containing list of functions under BUILd_SVC_MQ macro. Something like
BUILd_SVC_MQ("clear", clear_screen)
BUILd_SVC_MQ("delete", delete_something)

Upvotes: 3

Related Questions