+ 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?

11th Dec 2017, 5:29 PM
sam conann
sam conann - avatar
3 Answers
11th Dec 2017, 5:38 PM
sam conann
sam conann - avatar
+ 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...?
12th Dec 2017, 5:11 PM
sam conann
sam conann - avatar