fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void func1(double *ptr)
  5. {
  6. cout<<*ptr;
  7. }
  8.  
  9. void main()
  10. {
  11. const double ab=2;
  12. func1(&static_cast<double>(ab));//I put & operator infront of static_cast and this works.
  13. cin.get();
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:11: error: ‘::main’ must return ‘int’
 void main()
           ^
prog.cpp: In function ‘int main()’:
prog.cpp:12:32: error: lvalue required as unary ‘&’ operand
   func1(&static_cast<double>(ab));//I put & operator infront of static_cast and this works. 
                                ^
stdout
Standard output is empty