VISUAL Studio2013提示malloc是未定义的标识符
问题如下:
解决:
加上#include "malloc.h"
- #include<stdio.h>
- #include "malloc.h"
- typedef char ElemType;
- typedef struct BiNode{
- ElemType data;
- struct BiNode *lchild;
- struct BiNode *rchild;
- }BiNode,*BiTree;
- void preOrderCreateBiTree(){
- char ch;
- BiTree T;
- scanf("%c",&ch);
- if (ch=='#'){
- T = NULL;
- }
- else{
- T = (BiTree)malloc(sizeof(BiNode));
- }
- }