开发者

Somebody know What is the name of this algorithm?

开发者 https://www.devze.com 2023-04-11 16:26 出处:网络
This is an algorithm for converting an string to an integer: int n = 0; for (i = 0; i < digits.lengt开发者_高级运维h; i++)

This is an algorithm for converting an string to an integer:

int n = 0;
for (i = 0; i < digits.lengt开发者_高级运维h; i++)
  n = n * 10 + (digits[i] - '0');

Somebody know what is the name of this algorithm? I need it for a reference in an article. I have used it but now I need some reference.


If you had to give a name to it, most likely it would be atoi (like the C function)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号