C中数组和结构体的区别
C 编程语言中数组和结构之间的主要区别如下 -
数组 | 结构 |
---|---|
An array is a single entity representing a collection of data items of same data types. | 结构是表示不同数据类型的数据项集合的单个实体。 |
Individual entries in an array are called elements. | 结构中的单个条目称为成员。 |
An array declaration reserves enough memory space for its elements. | 结构定义为其成员保留了足够的内存空间。 |
There is no keyword to represent arrays but the square braces [] preceding the variable name tells us that we are dealing with arrays. | 关键字 struct 告诉我们可以处理结构。 |
Initialization of elements can be done during array declaration. | 成员的初始化只能在结构定义期间完成。 |
The elements of an array are stored in sequence of memory locations. | 结构的成员不是按内存位置顺序存储的。 |
The array elements are accessed and followed by the square braces [] within which the index is placed. | 结构的成员由点运算符访问。 |
Its general format is data type variablename [size]; | 其一般格式如下 -struct <struct name>{ |
For example,int sum (100); | 例如,struct student{ |
以上是 C中数组和结构体的区别 的全部内容, 来源链接: utcz.com/z/317286.html