+ 2
What's happening!!š¤š¤šš²
guys i write this code in cpp #include <iostream> #include<conio.h> using namespace std; class stud { int yp; char modi; }; int main() { stud x; cout<<"size"<<sizeof(x); return 0; } output is 8 shouldn't the output be 3 ??(according to me) ,but when i declare only char variable in class,then output is 1.(which is right) and when i declare only int variable ,the output is 4 ,(what's happening)?? š«š« what is this happening...? can someone tell me is it happening this only with me or with u also?
3 Answers
+ 2
try this code here
https://code.sololearn.com/c49z6N5vDAiu/?ref=app
+ 1
thx bro,now i understand it....
but
if i try this program on old turbo cpp then it is giving answer as sum of individual data members sizes...
how it can be explain...?