C++数据结构声明

标签 c++ struct

struct movies_t {
  string title;
  int year;
} films [3];

来自本教程: http://www.cplusplus.com/doc/tutorial/structures/

如果我没理解错的话,films 是 movies_t 类型的四个数据结构数组的声明。这是正确的还是有其他原因?

谢谢...

最佳答案

If I understand correctly films is the declaration of an array of four data structures of the type movies_t. 

没有。它的大小为 3,索引为 012。

films [0]
films [1]
films [2]

关于C++数据结构声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21225750/

相关文章:

c++ - Boost 仅序列化 std::wstring 的第一个字符

c++ - 我不认为这是类型转换,但它是什么?

c - 在 C 编程中将结构指针传递给函数和结构填充

c - Domino 程序问题

c - 读取二进制文件时如何分别对每个结构体字段使用 fread() ?

c++ - 我的引用变量发生了什么?

java - cpp :char(-1) in Java-char

c++ - C/C++ : Pointer on Pointer on structure

c++ - 如何从 C 调用 C++ 函数?

c++ - 具有隐式参数、前向声明、C++ 的模板