为啥在Dev可以运行,在VS就报错呢
  • 板块灌水区
  • 楼主TSqqq
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/1/25 15:39
  • 上次更新2023/10/28 11:00:30
查看原帖
为啥在Dev可以运行,在VS就报错呢
650660
TSqqq楼主2022/1/25 15:39
#include <iostream>
#include <cstdlib>
using namespace std;

typedef struct node
{
	int data;
	pNODE next;
}NODE, * pNODE;

int main()
{
	pNODE head, p, q, t;
	int a, i, n;
	cin >> n;
	head = NULL;

	for (i = 1; i <= n; i++)
	{
		cin >> a;
		p = (pNODE)malloc(sizeof(NODE));
		p->data = a;
		p->next = NULL;
		if (head == NULL)
			head = p;
		else
			q->next = p;
		q = p;
	}
	t = head;
	while (t != NULL)
	{
		cout << t->data;
		t = t->next;
	}
	free(p);

	system("pause");
	return 0;
}
2022/1/25 15:39
加载中...