Study

struct node {
    int data ;
    node *next ;
    // 构造方法
    node(int num):data(num),next(NULL){}
    node():next(NULL){}
};
node *p=new node(100); 
/*
可直接初始化对象
p->data=100;
p->next=NULL;
*/

haode

  • 1
  • 2
  • 2

2

#include<bits/stdc++h>
using namespace std;