【发布时间】:2013-08-20 19:34:32
【问题描述】:
代码:
#include<stdio.h>
#include<malloc.h>
#include<conio.h>
typedef struct singlylist *nodeptr;
typedef struct singlylist *position;
struct singlylist
{
int x;
position next;
}
。
typedef struct singlylist List;
List L;
int isempty(List A)
{
return(A.next==NULL);
}
void create()
{
L=(struct singlylist)malloc(sizeof(struct singlylist));
L.next=NULL;
}
main()
{
create();
if(isempty(L))
puts("Empty list !!!");
getch();
}
错误: 无法从 void* 转换为单一列表。
问题: 我无法弄清楚错误背后的原因。谁能解释一下这是什么错误?
【问题讨论】:
-
记住你不应该在
malloc()和memcpy()的情况下投 -
C 或 C++ 请在这两种语言中应用不同的规则。