atoll() in C++

atoll(): This function is available in the file stdlib.h.This function converts a string to a long long integer. This function parses the C-string str interpreting its content as an integral number, which is returned as a value of type long long int. It takes one parameter.

Parameters: One parameter is required for this function.

str: C-string containing the representation of an integral number.

Syntax:

atoll(str)

For Example:

atoll("181818181881.888") = >It returns 181818181881

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    char str[] = "181818181881.888";

    cout << atoll(str<< "\n";
    

    return 0;
}


No comments:

Post a Comment