-4
#include<iostream>

using namespace std;

class HERO {

char name [100]; 
char level;
int health;  
     }; 

int main(){

HERO h1;

cout<< "size :"<<sizeof(h1)<<endl;

return 0;

}

in this code i was trying to find size of object h1, it should be 105 byte but instead it show 108 byte i was confused how it showing 108 , when i try to calculate individually it shows correctly as i expected , but when i try to calculate wholly it shows 108 , so how it showing 108 byte.

enter image description here

Rayrty
  • 1
  • 1

0 Answers0