C
C#16mo ago
Anxoul

❔ Having compiler -output related query

So I trying to print the sizeof structure that I made it has an integer (4bytes) and character (1 bytes) thus the sizeof on structure object should be 5 but it's printing 8 what am I getting wrong? --code-- '// Online C compiler to run C program online #include <stdio.h> int main() { struct student { int id; char c; // struct student *s1; }; struct student s; printf("%ld\n",sizeof(int)); printf("%ld\n",sizeof(char)); //printf("%ld\n",sizeof(student)); printf("%ld\n",sizeof(s)); // s[2] = {{1},{2}}; // for(int i =0; i<2; i++) printf("%d", s[i].id); // printf("Hello world"); return 0; }'
4 Replies
Hackmagician
Hackmagician16mo ago
This is the C# server, for C/C++ follow below: $cpp
MODiX
MODiX16mo ago
We're partnered with Together C & C++, check them out here: https://discord.gg/vnyVmAE
Anxoul
AnxoulOP16mo ago
yes sure
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server