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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:33:20+00:00 2026-06-13T14:33:20+00:00

I am trying to understand the difference between a typedef and define. There are

  • 0

I am trying to understand the difference between a typedef and define. There are a lot of good posts specially at this previous question on SO, however I can’t understand the post that states

#define is a preprocessor token: the compiler itself will never see it.
typedef is a compiler token: the preprocessor does not care about it.

Could anyone please explain this with a little more detail. I am confused with the term preprocessor 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-13T14:33:23+00:00Added an answer on June 13, 2026 at 2:33 pm

    The pre-processor is a program that runs before the compiler and essentially performs text substitution. When you write:

    #define X 10
    
    int main() 
    {
        int x = X;
    }
    

    The pre-processor take that file as input, does it’s thing, and outputs:

    int main() 
    {
        int x = 10;
    }
    

    And then the compiler does its thing with the pre-processed output.

    typedef on the other hand is a construct that the compiler understands. When you write:

    typedef unsigned int uint_32;
    

    The compiler knows that uint32 is actually an alias for unsigned int. This alias is handled by the compiler itself and involves a bit more logic than simple text substitution. This becomes obvious with a simple example:

    typedef int my_int;
    
    int main()
    {
        unsigned my_int x;  // oops, error
    }
    

    If a typedef were a simple text substitution mechanism (like the pre-processor is) then that would work, but it is not allowed and will fail to compile.

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

Sidebar

Related Questions

I am trying to understand the difference between this: if (isset($_POST['Submit'])) { //do something
I'm trying to understand the difference between sequences and lists. In F# there is
I am trying to understand the difference between this list: UIRequiredDeviceCapabilities and individual keys
Been trying my best to understand this correctly. What is the difference between an
I am trying to understand this particular difference between the direct and delegated event
I am trying to understand the difference between dijit.byId and dojo.byId For this i
I am trying to understand the difference between __getattr__ and __getattribute__ , however, I
I am trying to understand if there is any difference between: (function($){ ... })(jQuery);
just had a noob question. I'm trying to understand the difference between calling self
I'm trying to understand the difference between a squash and a rebase. As 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.