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 9137811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:31+00:00 2026-06-17T09:10:31+00:00

For example I have a macro: #define PRINT(int) printf(#int %d\n,int) I kinda know what

  • 0

For example I have a macro:

#define PRINT(int) printf(#int "%d\n",int)

I kinda know what is the result.
But how come #int repersent the whole thing?

I kinda forget this detail. Can anybody kindely give me a hint?

Thanks!

  • 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-17T09:10:32+00:00Added an answer on June 17, 2026 at 9:10 am

    In this context (applied to a parameter reference in a macro definition), the pound sign means to expand this parameter to the literal text of the argument that was passed to the macro.

    In this case, if you call PRINT(5) the macro expansion will be printf("5" "%d\n", 5); which will print 5 5; not very useful; however if you call PRINT(5+5) the macro expansion will be printf("5+5" "%d\n", 5+5); which will print 5+5 10, a little less trivial.

    This very example is explained in this tutorial on the C preprocessor (which, incidentally, is the first Google hit for c macro pound sign).

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

Sidebar

Related Questions

I have a macro as such #define PTF(A,y) fprintf(file,%s,A,y);printf(%s %d,A,y); so that it will
Example: I have a view controller and get rid of it. But there's still
I have a general macro: #define mSwitch( Root, Case ) Root##_Case_##Case #define mSpecialDisplay( what,
I have the following macro: #define IF_TRACE_ENABLED(level) if (IsTraceEnabled(level)) The user code should look
I have macro like this: #define error_exit(format, ...) \ error_at_line(EXIT_FAILURE, 0, __FILE__, __LINE__, format,
I have this macro code, which allows me to define both a C enum
I have the following preprocessor divective: #ifndef NDEBUG #define TRACE printf #else #define TRACE(...)
I have an example code like this: int var; var = MACRO_A; I expect
I have a #define to my new macro, to use my own allocator, such
I have an input string which is a directory address: Example: ProgramFiles/Micro/Telephone And I

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.