Home
menubar
rss_feed

Previous Reference C++ Reference <cstdlib> Next Reference




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:








Previous Reference C++ Reference <cstdlib> Next Reference




Home | Reference | Play Games! | Blog | Forum | Site Map | Contact Us


shadow bottom image