C++中链接列表的问题

And*_*rič 1 c++ linked-list

我对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)

问题显然是,为什么不编译?:(

预先感谢您的任何帮助!

cli*_*hlt 6

从结构声明中删除"()".你的编译器应该告诉你.