What is the output of the following


What is the output of the following code?
#include
#include
#include
struct g
{
g():n(0){}
int operator()() { return n++; }
int n;
};
int main()
{
int a[10];
std::generate(a, a+10, g());
std::copy(a, a+10, std::ostream_iterator(std::cout, " "));
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: What is the output of the following
Reference No:- TGS01481142

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)