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





