#include <iostream>
using namespace std;
void f( double * x, int n)
{
for ( int i = 0 ; i< n; i++ )
{
cout << x[ i] << ", " ;
}
cout << endl;
}
int main( ) {
// your code goes here
double x[ ] = { 1 ,2 ,3 ,4 ,5 ,6 } ;
f( x,6 ) ;
f( { 1 ,2 ,3 ,4 ,5 ,6 } ,6 ) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBmKGRvdWJsZSAqIHgsIGludCBuKQp7Cglmb3IoaW50IGkgPTA7aTxuO2krKykKCXsKCWNvdXQgPDwgeFtpXSA8PCAiLCAiOwoJfQoJY291dCA8PCBlbmRsOwp9CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCWRvdWJsZSB4W10gPSB7MSwyLDMsNCw1LDZ9OwoJZih4LDYpOwoJZih7MSwyLDMsNCw1LDZ9LDYpOwoJcmV0dXJuIDA7Cn0=
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:17:19: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘double*’ for argument ‘1’ to ‘void f(double*, int)’
f({1,2,3,4,5,6},6);
^
stdout