typedef struct ltbl
{
struct ltbl* pNxt; /* 指向链表中后一个元素的指针 /
int note;
int empty;
int effect; / KEY VALUE /
int Total;
char *PATH; / dizhi */
}LTBL;
char *Z_path = NULL;
LTBL * p = NULL;
Z_path = (char*) malloc( (length + strlen(FileInfo.name) + 1) * sizeof(char) );
P->PATH = Z_path; //为啥有误????
char *Z_path = NULL;
LTBL * p = NULL;
Z_path = (char*) malloc( (length + strlen(FileInfo.name) + 1) * sizeof(char) );
P->PATH = Z_path; //为啥有误????
因为p还是NULL,没有malloc分配空间
p修改为小写。
代码没有问题。
LTBL * p = (LTBL *)malloc(sizeof(LTBL));
没有给p分配内存,最后一行p要小写。