How to convert char array into a single int in C++

1 Answer

0 votes
#include <iostream>

int main() {
    char arr[] = "8493";
    
    int n = std::atoi(arr);

    std::cout << n;
}




/*
run:

8493

*/

 



answered Jun 22, 2021 by avibootz

Related questions

1 answer 144 views
1 answer 159 views
1 answer 185 views
1 answer 167 views
...