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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:48:23+00:00 2026-05-27T07:48:23+00:00

This is a stupid question, but I can’t work it out and it’s beginning

  • 0

This is a stupid question, but I can’t work it out and it’s beginning to irritate me!

I have the following (reg is a global):

#define CS 4
#define DS 5

unsigned char reg[6] = {0, 0, 0, 0, 0, 0x10};

Now, I would expect reg[DS] to access element 5 of array reg (0x10). However, when debugging (VC2010), Visual Studio is claiming that DS is zero and the first element is accessed. Is it me, or is Visual Studio being stupid?

  • 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-05-27T07:48:24+00:00Added an answer on May 27, 2026 at 7:48 am

    Yes.

    reg[DS] == 0x10
    

    Unless you have redefined the macro DS somewhere else in the code.
    Macros are evaluated at pre-compilation. So if you defined DS as 5 then what goes to the compiler for compilation is reg[5].

    Also, You cannot check a macro value at run-time because they do not exist at run-time, they are already substituted with whatever value they are defined as.

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

Sidebar

Related Questions

Probably a stupid question but so far I can't figure this out... I have
I have a feeling this is a stupid question but I can't find the
This is probably a really stupid question but I can't figure this out. I
This sounds like a stupid question but i can't figure it out for the
Sorry if this is a stupid question, but I can't get this to work.
I am sure this is a stupid question but I can't figure out how
This may be a stupid question but I can't seem to figure this out.
I feel like this is a stupid question, but I can't think of a
This maybe a stupid question, but as I can not easily undo my change
This might be a stupid question, but I can't for the life of me

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.