英文:
What is the proper term for an item in an array?
问题
我最近参加了一个编程考试,我的老师问我:“你怎么称呼数组中包含的东西?”(或类似的问题)
我的回答是:“元素或项。”
我的老师然后一遍又一遍地问我同样的问题,直到我不得不放弃,问他正确的术语是什么。
我的老师回答:“变量。”
我知道什么是变量,但它并不像只在数组中才会出现。我是否误解了他的问题?我有很多实际的代码要展示,但他在这个问题上纠缠不清,导致我后来没有太多时间了。
我想听听你对此的看法。
(如果这个问题不适合在StackOverflow上提出,我道歉)
英文:
I recently had a programing exam, and my teacher asked me: "What do you call the things that an array consists of?" (or something like that)
My response: "elements or items."
My teacher then asked me the same question over and over again, untill i had to give up and ask him what the proper term was.
My teacher answered: "variables."
I know what a variable is, but its not like it is only found in arrays. Am i misunderstanding his question? I had a lot of actual code to present, but he got so hung up at that one question that i didnt have much time left afterwards.
I would like to hear your thoughts on this.
(apologies, if this question does not belong on StackOverflow)
答案1
得分: 3
我不确定你或你的老师会认为什么是权威答案,但C#语言规范将数组元素定义为变量的子类型1。
特别要注意的是,它将它们称为数组元素,而不是变量:
> C#定义了八种变量类别:静态变量、实例变量、数组元素、值参数、输入参数、引用参数、输出参数和局部变量。
你老师的问题就像问
> 哪种大型猫科动物有鬃毛?
并期望你回答“动物”,而不是“狮子”。
英文:
I’m not sure what you or your teacher would consider an authoritative answer to this, but the C# language specification defines array elements as a sub-type of variable.
Notably, it does refer to them as array elements, not variables:
> C# defines eight categories of variables: static variables, instance variables, array elements, value parameters, input parameters, reference parameters, output parameters, and local variables.
Your teacher’s question is like asking
> which kind of big cat has a mane?
And expecting you to respond “animal” instead of “lion”.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论