关于VS2019调试问题:进程已退出,代码为-1073741819

  • Post author:
  • Post category:其他


关于VS2019调试问题:进程已退出,代码为-1073741819

详情:在用VS2019写关于链表的代码时,遇到没有报错,但是调试之后显示进程已退出,代码为-1073741819。的问题

截图:

在这里插入图片描述

代码如下:

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>

//创建链表
struct linknode
{
	int data;
	struct linknode* next;
};

//初始化链表->创建一个空链表
struct linknode* init_list()
{
	//创建头结点
	struct linknode* head = malloc(sizeof(struct linknode));
	head->data = 0;
	head->next = NULL;

	//创建尾节点
	struct linknode* p = head;
	//获得用户输入
	int nodedata = 0;
	while (1)
	{
		printf("请输入值(输入等于0的值退出):");
		scanf_s("%d", &nodedata);
		if (nodedata == 0)
		{
			break;
		}

		//创建新结点
		struct linknode* newnode = malloc(sizeof(struct linknode));
		newnode->data = nodedata;
		newnode->next = NULL;

		//把新结点插入链表中
		p->next = newnode;

		//更新尾指针
		p = newnode;
	}
	return head;//返回头节点即返回列表
}

//在old_data值之后插入一个new_data值(在原来的结点后面串联一个新的结点)
void addlist(struct linknode* head, int old_data, int new_data);

//删除数据
void dellist(struct linknode* head, int deldata);

//遍历打印链表
void showlist(struct linknode* head)
{
	/*if (head == NULL)
	{
		return;
	}*/

	struct linknode* p = head->next;//创建尾结点让他指向第一个空头结点的地址域
	while (p != NULL)
	{
		printf("%d", p->data);
		p = p->next;
	}
}

//清空链表
void clearlist(struct linknode* head);

//摧毁链表
void destory_list(struct linknode* head);

int main()
{
	struct linknode *head = init_list();
	showlist(&head);
	return 0;
}

求各位大佬帮助,网上也查了原因但是依然没用!



版权声明:本文为qq_51553982原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。