Question
1.
#include
2.
using namespace std;
3.
template
4.
void loopIt(T x)
5.
{
6.
T val[count];
7.
for(int ii = 0; ii < count; ii++)
8.
{
9.
val[ii] = x++;
10.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
template
4.
void loopIt(T x)
5.
{
6.
T val[count];
7.
for(int ii = 0; ii < count; ii++)
8.
{
9.
val[ii] = x++;
10.
cout
Answer: Option C
Was this answer helpful ?
Answer:d
Explanation:In this program, We are using the non-type template parameter to increment the value in the function template.
Output:
$ g++ farg4.cpp
$ a.out
2.1
3.1
4.1
Was this answer helpful ?
Submit Solution