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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:33:35+00:00 2026-05-12T10:33:35+00:00

What is the difference between sizeof(3.0) and sizeof(3.0f) I was expecting both of them

  • 0

What is the difference between sizeof(3.0) and sizeof(3.0f)

I was expecting both of them to give the same result (sizeof float)..but its different.

In 32 bit machine,gcc compiler,
sizeof(3.0f) =>4
sizeof(3.0) => 8

Why so?

  • 1 1 Answer
  • 1 View
  • 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-12T10:33:36+00:00Added an answer on May 12, 2026 at 10:33 am

    Because 3.0 is a double. See C syntax Floating point types.

    Floating-point constants may be
    written in decimal notation, e.g.
    1.23. Scientific notation may be used by adding e or E followed by a decimal
    exponent, e.g. 1.23e2 (which has the
    value 123). Either a decimal point or
    an exponent is required (otherwise,
    the number is an integer constant).
    C99 introduced hexadecimal
    floating-point constants, which follow
    similar rules except that they must be
    prefixed by 0x and use p to specify a
    hexadecimal exponent. Both decimal and
    hexadecimal floating-point constants
    may be suffixed by f or F to indicate
    a constant of type float, by l or L to
    indicate type long double, or left
    unsuffixed for a double constant.

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

Sidebar

Related Questions

Could somebody tell me the difference between: int *p; p=(int*)malloc(10*sizeof(int)); free(p); or int *p;
Someone recently asked me the difference between a C++ standard operator (e.g. new,delete,sizeof) and
maybe stupid question, but i dont know answer. What is difference between using GetModuleHandle
What is the difference between dir(x) and dir(x.__class__) ? The latter returns a different
What's the difference between struct mystruct *ptr = (struct test *)malloc(n*sizeof(struct test)); and struct
What is the difference between doing: ptr = malloc(MAXELEMS * sizeof(char *)); And: ptr
Difference between start-pointers and interior-pointers and in what situation we should prefer one over
The difference between Chr and Char when used in converting types is that one
What's the difference between CopyIcon and DuplicateIcon ?
JAVA : is there a difference between the two references p && pp? PrintStream

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.