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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:38:19+00:00 2026-06-10T02:38:19+00:00

I have two unrelated questions: Is it possible to use #define to define something

  • 0

I have two unrelated questions:

  1. Is it possible to use #define to define something other than a number? (Such as an extended ASCII character).

  2. Is it considered good practice to use preprocessor directives within the main() function? The only reason I would ever think to do this is to execute different code depending on which OS is being run.

  • 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-10T02:38:21+00:00Added an answer on June 10, 2026 at 2:38 am

    Object-like macros (#define macros with no arguments) are simply replacements. So anything that might otherwise be in your code can be the replacement, for example a literal string: #define PROGRAM_NAME "MyProgram", or multi-line code blocks. Here’s a useless example of the latter:

    #define INFINITE_PRINTF while (1) \
                            { \
                                printf("looping..."); \
                            }
    

    As for the second question, it is common practice to use preprocessor directives throughout C code to do just what you’ve mentioned: conditionally including/excluding code, in main and elsewhere. Occasionally I’ll use #define for constants near where they’ll be used, for clarity.

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

Sidebar

Related Questions

I currently have two unrelated MVC3 projects hosted online. One works fine, the other
Similar to these other questions noted below, I have two tables with the structure:
I have two jQuery UI dialogs (unrelated to each other but both are exhibiting
I have two unrelated processes that use .NET assemblies as plugins. However, either process
I have two (unrelated) classes. The first one is Point: typedef std::complex<double> complex_number; class
I have two unrelated repositories 'public' and 'develop': prj/ public/ develop/ 'develop' has lots
OK, so I have two (completely unrelated, different project) classes using iterators now. One
I have previously asked two questions Question 1 and Question 2 but there is
I want to have the equivalent of two completely unrelated tables in my database,
I have two pages. One aspx page and the other an aspx page but

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.