Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8848089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:20:45+00:00 2026-06-14T12:20:45+00:00

I have a test program like below. #define TEST(A,B) A #define TEST2(A,B) (A,B) #define

  • 0

I have a test program like below.

  #define TEST(A,B)  A
  #define TEST2(A,B) (A,B)
  #define TEST3(A,B) TEST TEST2(A,B)

  int main()
  {
     TEST3(Hello,World)  //This will expand to TEST (Hello,World)
     TEST (hello, World) // This will expand to hello
  }

The TEST3 will expand to “TEST (Hello,World)“, but it won’t be expanded further using TEST definition. I initially thought it must be due to a space between TEST and TEST2(hello, world) in the TEST3 definition. But the plain invocation of TEST (hello, world) expands properly. Can someone explain what is happening here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:20:46+00:00Added an answer on June 14, 2026 at 12:20 pm

    The word TEST in #define TEST3(A,B) TEST TEST2(A,B) is not a function-like macro invocation because it is not followed by an open parenthesis. When the pre-processor is expanding TEST3(Hello, World), it encounters TEST, finds it is not an invocation of a function-like macro, and outputs it as text; then it processes TEST2(A, B) and that is a macro invocation, so it outputs the corresponding text, which is (Hello,World), and it continues the processing with the open parenthesis. The TEST is gone, never to be preprocessed again.

    See C preprocessor and concatenation for a full discussion of macro expansion with quotes from the standard. You might find How to make a char string from a C macro’s value of some help, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have hierarchy like this (This is just a test program. Please
I have a c program below, I would like to send out a 32
I have a vector like below vector<unsigned int> myvector; vector<unsigned int>::iterator it; //fill it
I have a very simple test program, running on Solaris 5.8: #include <stdio.h> #include
I have a simple RabbitMQ test program randomly enqueuing messages, and another reading them,
I wrote a small test program for flipperview. I have 3 views. I call
I'm stress testing a web app and have set up a windows test program
I'm using Visual Studio 2008. I have a DLL and a test program EXE.
I have a 200 MB text file. But, I need to test my program
I have made a front end for a program which test java (foo.class) binary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.