c++ - 为什么在链表中使用 struct 关键字和结构名称来创建节点的指针
问题描述
struct linklist
{
int data;
struct linklist *next;
}
为什么要struct linklist
在前面使用*next
?可以简单地创建一个指针*node
?
解决方案
为什么我们在 '*next' 前面使用 struct linklist
您不需要在这里使用详细的类型说明符。所以我想你使用它是因为你可以。
或者您可能打算跨语言边界使用该结构,在这种情况下您使用它是因为有必要在 C 中使用它。
推荐阅读
- java - 使用数组中的每一行查找段落类中的某些单词
- c# - AspNetCore api 版本控制 MapToApiVersion 未发现但仍能到达路线
- c# - .NET Core 上的 Kestrel 缺少 HTTP 标头
- javascript - 如何以编程方式使用 Shopify Admin API (Node.js / JavaScript) 创建/添加管理员链接
- css - 具有小数百分比高度的 CSS 元素仍然占用 flex 容器中的空间
- compiler-errors - Solidity 和 truffle 的编译器问题
- python - 使用不带 IPyWidgets 的拥抱脸转换器
- vba - Excel VBA 从 Outlook 获取所有会议,包括重复
- python - 基于 JSON 更新 SQL 数据库寄存器
- excel - 如何仅自动填充可见单元格?