Answered step by step
Verified Expert Solution
Question
1 Approved Answer
int i = 42, *p = &i, &r = i; decltype (*p) c; // error: c is int& and must be initialized Above is the
int i = 42, *p = &i, &r = i;
decltype (*p) c; // error: c is int& and must be initialized
Above is the an example of C++ decltype. I know with the asterisk*, we are dereferencing the pointer p and we get the object to which the pointer p points. But how does decltype (*p) end up with an int& type, but not a plain int?
Thank you, will upvote for a detailed answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started