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

  • Home
  • SEARCH
  • 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 9164469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:41:27+00:00 2026-06-17T14:41:27+00:00

Possible Duplicate: static const vs #define in C My first thought is that this

  • 0

Possible Duplicate:
“static const” vs “#define” in C

My first thought is that this is implied, but is there ever a reason why you would use const instead of #define?

If you set a global variable, why would you ever want to change it, and wouldn’t you want to protect it globally as well?

  • 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-17T14:41:29+00:00Added an answer on June 17, 2026 at 2:41 pm

    Const usually replaces #define

    #define is a pre-processor macro that can do textual replacement. You can use it to define a constant or a macro or do all sorts of other things.

    const is a type-safe way to define a compile-time constant

    These two mechanisms occur at different times in the compilation process, but in general, const was created to rectify the problems of #define.

    I’ve rarely seen people do something like

    #define CONSTINT  const int
    

    but it is legal.

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

Sidebar

Related Questions

Possible Duplicate: Why aren't static const floats allowed? Is there any reason why this
Possible Duplicate: “static const” vs “#define” in c When I do this : #define
Possible Duplicate: Java: Global Exception Handler I thought of something like this: public static
Possible Duplicate: static const vs #define in C I started to learn C and
Possible Duplicate: Is there a reason to use enum to define a single constant
Possible Duplicate: Difference between static class and singleton pattern? Why would one ever require
Possible Duplicate: static const vs #define In C++, to define a constant to be
Possible Duplicate: static const vs #define in C In Objective-C what is the difference
Possible Duplicate: C++ - defining static const integer members in class definition Note: There
Possible Duplicate: “static const” vs “#define” in c I am going through the K&R

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.