gpt4 book ai didi

naming-conventions - 谁 "invented"i,j,k 作为整数计数器变量名?

转载 作者:行者123 更新时间:2023-12-03 18:08:17 25 4
gpt4 key购买 nike

这个问题已经存在:




12 年前关闭。




Possible Duplicate:
Why are we using i as a counter in loops



我自己使用这些已经超过 15 年了,但真的不记得我是如何/从哪里养成这个习惯的。由于它真的很普遍,我很想知道最初是谁建议/推荐将这些名称用于整数循环计数器(是 K&R 书吗?)。

最佳答案

i = integer

Comes from Fortran where integer variables had to start with the letters I through N and real variables started with the other letters. Thus I was the first and shortest integer variable name. Fortran was one of the earliest programming languages in widespread use and the habits developed by programmers using it carried over to other languages.



(来自: Why are we using i as a counter in loops)

显然, jk只是您最喜欢的字母表中的下一个。

关于naming-conventions - 谁 "invented"i,j,k 作为整数计数器变量名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1147312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com