2

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>
};
3
  • tutorialspoint.com/cprogramming/c_structures.htm Commented Jan 8, 2015 at 4:50
  • You have a #define and a #include in the middle of a structure declaration??!! It may well be legal, but ... Commented Jan 8, 2015 at 13:20
  • @ratednitesh Did you perhaps mean to type: #define BUILD_SVC_MQ(name, func) , (Fn*) func Commented Jan 8, 2015 at 13:59

1 Answer 1

3
  • 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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.