---单链表中:
typedef struct node//单链表中一个结点的定义
{
int data;
struct node *next;
}Lnode;
int main()
{
Lnode *L;//注意,这里定义了一个struct node类型的指针,
//是利用了结构体指针指向malloc申请的无名地址,却没有定义成struct node类型的变量。
//来表示一个单链表结点,//要保护实参不发生变化,则用const和指针或者引用联合
return 0;
}
(a)结构体做参数时,复制了一个新的结构体对象
int f(STime time)(b)结构体指针或者结构体引用,做参数时不复制,可以作为返回型参数
int f(STime &time)(c)引用型参数调用速度快,有时不希望调用函数的实参变化。
int f(const STime &time)(d)使用结构体指针
int f(STime *time)(c)保护结构体指针
int f(const STime *time)