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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:31:41+00:00 2026-05-23T05:31:41+00:00

Possible Duplicate: size of a datatype without using sizeof This is question asked in

  • 0

Possible Duplicate:
size of a datatype without using sizeof

This is question asked in a C interview I wanted to know what is the correct logic for this

If you are not having a sizeof operator in C, how will you get to know
the size of an int ?

  • 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-23T05:31:42+00:00Added an answer on May 23, 2026 at 5:31 am

    Use an array[*]:

    int a[2];
    int sizeof_int = (char*)(a+1) - (char*)(a);
    

    Actually, due to a note in the section on pointer arithmetic, you don’t even need an array, because for the purposes of pointer arithmetic an object behaves like an array of size 1, and an off-the-end pointer is legal for an array:

    int a;
    int sizeof_int = (char*)((&a)+1) - (char*)(&a);
    

    [*] By which I mean, “a solution to the puzzle posed is to use an array”. Don’t actually use an array, use sizeof!

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

Sidebar

Related Questions

Possible Duplicate: Array size too big - ruby Sorry if this has been asked,
Possible Duplicate: Determine word size of my processor It is One Interview question today.
Possible Duplicate: Size of folder or file I used this code to instantiate a
Possible Duplicate: Sizeof an array in the C programming language? Why is the size
Possible Duplicate: How does delete[] “know” the size of the operand array? Assume i
Possible Duplicate: Sizeof doesn't return the true size of variable in C C ->
Possible Duplicate: How to implement garbage collection in C++ I was recently asked this
Possible Duplicate: Importance of varchar length in MySQL table When using VARCHAR (assuming this
Possible Duplicate: Checking available stack size in C EDIT2: My question is Duplicate of
Possible Duplicate: programatically get the file size from a remote file using delphi, before

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.