|
|
![]() |
![]() |
![]() |
C++ Reference: atof()
atof()
Declaration
double atof(const char*);
Description
Takes in a number as a null-terminated char string and returns the value as a double.
Example
#include <iostream>
#include <cstdlib>
int main() {
using namespace std;
char caNullTermString[] = "1.2";
double dA = atof(caNullTermString);
double dB = atof("3.4");
cout << (dA + dB) << endl;
return 0;
}
Output:
![]() |
![]() |
![]() |
| Home | | | Reference | | | Play Games! | | | Forum | | | Site Map | | | Contact Us |






