C++零散 学习记录

C++ 链表 删除节点

node* del(node *head){
	node *temp;
	while (head!=NULL)
	{
		temp = head;
		head = temp->next;
		temp = nullptr;   ///删除之前先将指针置空
		delete(temp);
		cout << "删除成功" << endl;
		display(head);
	}
	return head;
}

Vector数组相关

for(auto e:v)  //e在v里依次取数据,为空时跳出循环

猜你喜欢

转载自blog.csdn.net/songer93/article/details/81053556