To demonstrate what you have learned about C++ data types answer the following q
ID: 3598835 • Letter: T
Question
To demonstrate what you have learned about C++ data types answer the following questions:
a)Do all pointer types need the same storage? Why/why not?
b)Does the size of a pointer reflect the size of the data type it is pointing to?
c)Does the size of an enum differ with the number of elements? Why/why not?
d)Does the size of an array differ with the number of elements? Why/why not?
e)Does the size of a vector differ with the number of elements?
f)What is the reason for the difference in how much memory is allocated for strings?
g)Does C++ utilize name or structural type equivalence? Provide an example to justify your answer.
Explanation / Answer
Hi, I have answered first 5 questions.
Please let me know in case of any doubt in first five.
Please repost others in separate post.
a)Do all pointer types need the same storage? Why/why not?
Yes. Because pointer stores memory address, so all memory address is of same size.
b)Does the size of a pointer reflect the size of the data type it is pointing to?
No.
c)Does the size of an enum differ with the number of elements? Why/why not?
Yes. each element of enum takes some size, so enum with more elements takes more size.
d)Does the size of an array differ with the number of elements? Why/why not?
Yes. each element of array takes some size, so array with more elements takes more size.
e)Does the size of a vector differ with the number of elements?
Yes. each element of vector takes some size, so if vector with more elements takes more size.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.