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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:17:21+00:00 2026-05-26T04:17:21+00:00

Possible Duplicate: Determine word size of my processor It is One Interview question today.

  • 0

Possible Duplicate:
Determine word size of my processor

It is One Interview question today. But I didn’t know …


I think the interviewer meaned the word size of cpu.


I find an answer like this:

int cpu_bits(void *dummy1, void *dummy2) 
{ 
 long offset = (long)&dummy2 - (long)&dummy1; 
 int ret = 0; 
 if (8 == offset) 
     ret = 64; 
 else if (4 == offset) 
     ret = 32; 
 else if (2 == offset) 
     ret = 16; 
 else if (1 == offset) 
     ret = 8; 
 else 
     ret = -1; 
 return ret;  
} 

int main() 
{ 
 printf("%d\n", cpu_bits(NULL, NULL)); 
 return 0; 
} 

The result seems to be right, Do you think so ?

  • 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-26T04:17:22+00:00Added an answer on May 26, 2026 at 4:17 am

    Short answer: the standard does not define a data type that is guaranteed to correspond to the word size of the underlying architecture, and what “word size” means on modern CPU’s is quite a vague thing: Word Size versus Address Size.

    With current processors having compatibility modes, registers of a different size, advanced addressing modes and instructions suited for data of various widths, talking of a general “word size” is imprecise, to say the least.

    I suppose the interviewer is still living in the 90’s and remembers the dubiously called WORD and DWORD types that were introduced by WinAPI when most computers were still 16-bit.

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

Sidebar

Related Questions

Possible Duplicate: How to determine the content size of a UIWebView? Hai Guys, I
Possible Duplicate: In Java, what is the best way to determine the size of
Possible Duplicate: How to determine the date one day prior to a given date
Possible Duplicate: Determine if two binary trees are equal Got an interview yesterday, a
Possible Duplicate: How do determine if a polygon is complex/convex/nonconvex? I'd like to know
Possible Duplicate: Fastest way to determine if an integer's square root is an integer
Possible Duplicate: Is there any way to determine text direction from CultureInfo in asp.net?
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the
Possible Duplicate: Determine device (iPhone, iPod Touch) with iOS I am making a game
Possible Duplicate: How to determine if a number is a prime with regex? This

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.