C++ | Templates | Question 10
val = 2*funStruct<n-1>::val;
val = 1 ;
cout << funStruct<10>::val << endl;
(A) Compiler Error
Explanation: This is an example of template metaprogramming. The program mainly calculates 2^10.
Quiz of this Question
Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C
course to start learning today.