我对C++完全不熟悉,并且正在解决一个简单的问题.我试图用三个节点实现一个简单的链表.这是我的代码:
#include<iostream>
using namespace std;
struct node(){
int data;
struct node* next;
};
struct node* BuildOneTwoThree() {
struct node* head = NULL;
struct node* second = NULL;
struct node* third = NULL;
head = new node;
second = new node;
third = new node;
head->data = 1;
head->next = second;
second->data = 2;
second->next = third;
third->data = 3;
third->next = NULL;
return head;
};
Run Code Online (Sandbox Code Playgroud)
问题显然是,为什么不编译?:(
预先感谢您的任何帮助!
| 归档时间: |
|
| 查看次数: |
176 次 |
| 最近记录: |