its been a while since i read this. but if your asking how much space each one takes up, it varies depending on how big that class is. ints take up 4 bytes or something like that. as far as that class you were asking about, you need to add the size of each member and that will be its total size in bytes. i find it much easier to use the sizeof() function (its in c++ but i dont know about C#... never really cared haha).
here is some code:
Code:
struct EmployeeRecord {
int ID;
int age;
double salary;
};
int main()
{
cout << "sizeof(int): " << sizeof(int) << endl
<< "sizeof(float): " << sizeof(float) << endl
<< "sizeof(double): " << sizeof(double) << endl
<< "sizeof(char): " << sizeof(char) << endl
<< "sizeof(EmployeeRecord): " << sizeof(EmployeeRecord) << endl;
system("PAUSE");
return 0;
}
here it will say int's are 4 bytes each in size, float is 4, double is 8 and char is 1. also the EmployeeRecord is 16 bytes (the sum of all its members). If you want to know more about how it actually gets stored in memory, i'd suggest an asm tutorial. its one of the first few things they talk about. You will learn about segments and offsets. Its nothing we really need to concern ourselves with but knowledge is never wasted.
Testing 1..2.. 3..