How much memory will be allocated for anobject of class given below?
class Time{
int Hour;
int Min;
int Sec;
char ampm[2];
};
Select one:
a. 20
b. 14
C. 16
d. 18
For integer members total memory occupied = 2 x 3 = 6 bytes
For character array total memory occupied = 4 x 2 = 8 bytes
Total memory occupied = 6 + 8 = 14 bytes
Comments
Leave a comment