How size of a class can be calulated?

Answer Posted / shweta iyer

Size of a class can be calculated by adding up the size of all its data members.

For example:
class student
{
char name[20]; -----> 4*20=80
int rollno[5]; -----> 2*5=10
......
}

So size of class student is 80+10=90.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define a nested class.

615


What do the keywords volatile and mean mutable?

610


What does int * mean in c++?

641


What is the difference between a pointer and a link in c ++?

568


What do you mean by translation unit in c++?

676






How do you find out if a linked-list has an end?

656


What are iterators in c++?

599


Can the creation of operator** is allowed to perform the to-the-power-of operations?

582


Can c++ be faster than c?

604


How does list r; differs from list r();?

695


What is the best free c++ compiler for windows?

592


What is the first name of c++?

569


Why was c++ created?

560


What is a manipulator in c++?

717


Why we use #include conio h in c++?

597