+ Reply to Thread
Results 1 to 2 of 2

Thread: What is token pasting operator?

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Posts
    109

    What is token pasting operator?

    Hi all,

    I want to know about what is token pasting operator and its usage.

    Regards,
    Red

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Posts
    109
    Hi All,

    Actually I have found the solution and sounds pretty good.

    Please have a look at : http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx

    One of the usage is:

    Code:
    #define Execute_Function_Number(nNumber, userData) Function_##nNumber(userData)
    
    void Function_1(const char *pMessage)
    {
    	printf("Hello %s from Function_1", pMessage) ;
    }
    
    void Function_2(const char *pMessage)
    {
    	printf("Hello %s from Function_2, %s", pMessage) ;
    }
    
    void Function_3(const char *pMessage)
    {
    	printf("Hello %s from Function_3, %s", pMessage) ;
    }
    
    void UseDynamicFunction()
    {
    	Execute_Function_Number(1, "David") ;
    
    	Execute_Function_Number(2, "Rosy") ;
    
    	Execute_Function_Number(3, "Scott") ;
    }
    Regards.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts