How to convert char array to double in C++

1 Answer

0 votes
#include <iostream>

int main() {
    char arr[] = "89.012";

    double d = atof(arr);
    
    std::cout << d;
}



  
/*
run:
  
89.012
  
*/

 



answered Jun 20, 2021 by avibootz

Related questions

1 answer 184 views
1 answer 157 views
157 views asked Jun 20, 2021 by avibootz
2 answers 275 views
275 views asked Aug 7, 2019 by avibootz
1 answer 91 views
1 answer 295 views
1 answer 167 views
...