fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void f(double * x, int n)
  5. {
  6. for(int i =0;i<n;i++)
  7. {
  8. cout << x[i] << ", ";
  9. }
  10. cout << endl;
  11. }
  12.  
  13. int main() {
  14. // your code goes here
  15. double x[] = {1,2,3,4,5,6};
  16. f(x,6);
  17. f({1,2,3,4,5,6},6);
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
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
Standard output is empty