Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
template
4.
void loopIt(T x)
5.
{
6.
int count = 3;
7.
T val[count];
8.
for (int ii=0; ii < count; ii++)
9.
{
10.
val[ii] = x++;
11.
cout
Options:
A .  int
B .  float
C .  constant expression
D .  none of the mentioned
Answer: Option C

Answer:d
Explanation:
In this program, We are using the for loop to increment the value by 1 in the function template.
Output:
$ g++ ftemp5.cpp
$ a.out
2.1
3.1
4.1



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers