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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:41:22+00:00 2026-06-04T11:41:22+00:00

The output of this program is 28. I don’t understand how? According to me

  • 0

The output of this program is 28. I don’t understand how?
According to me this should be 32(4+4+4+4+12)+4(to maintain the alignment)=32.
Please explain the reason for displaying the output 28??

struct test{
    char c;
    int d;
    int x;
    int y;
    long double p;
    }t1;

printf("%d",sizeof(t1));
  • 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-04T11:41:24+00:00Added an answer on June 4, 2026 at 11:41 am

    Maybe your “long double” is actually the same as a double (8 bytes), and if you’re on a 32bit processor the alignment is 4-byte.

    4+4+4+4+8 = 24

    What is sizeof(long double)?

    EDIT:

    I used GCC’s __builtin_offset_of() and __alignof__ to investigate. The actual answer that explains the size of the struct is:

    4+4+4+4+12 = 28

    sizeof(long double) is 12.

    No padding is necessary because __alignof__(long double) is 4 and. Interestingly, __alignof__(double) is 8.

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

Sidebar

Related Questions

I don't understand the output of this program: int arr[]={1,7,4,2,5,8}; int x=(&(arr[arr[1]-arr[4]])-arr); printf(%d ,x);
I don't understand why the output of this program is Second method instead of
I got the output 0 2 for this program..... but don't know why? Please
Can anyone explain the output of this program and how I can fix it?
Possible Duplicate: What is recursion really and explain the output of this program? What
What should be the output of this C program? #include<stdio.h> int main(){ int x,y,z;
can any one give me the dry output for this program? #include <stdio.h> main()
When I attempt to compile the output of this trivial lex program: # lex.l
I have this output when trying to debug Program received signal SIGSEGV, Segmentation fault
I have written the following C program. The output is 32. Why is 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.