How can we convert a string to int for very large integer values?

前端 未结 4 1025
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 14:11

I have used the function atoi to convert character strings to int and it\'s working fine but when I gave

num = atoi (argv[1]) ;

/         


        
4条回答
  •  借酒劲吻你
    2021-01-12 14:43

    You can use strtoull for very long numbers.

    unsigned long long int strtoull(const char *nptr, char **endptr,
                                           int base);
    

    Compile with C99 support -std=c99 or provide the defines in man strtoull to get the definition.

提交回复
热议问题