CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
C++ Quiz #130

decltype(x) Versus decltype((x))

hardTemplates

a is declared with decltype(x) and b with decltype((x)), the same variable with an extra pair of brackets. What is printed?

📄 Code

1#include <iostream>
2 
3int main() {
4 int x = 5;
5 decltype(x) a = x;
6 decltype((x)) b = x;
7 a = 10;
8 b = 20;
9 std::cout << x << " " << a << " " << b << "\n";
10 return 0;
11}