VISUAL Studio2013提示malloc是未定义的标识符

问题如下:

VISUAL Studio2013提示malloc是未定义的标识符

解决:

加上#include "malloc.h"

  1. #include<stdio.h>  
  2. #include "malloc.h"  
  3. typedef char ElemType;  
  4. typedef struct BiNode{  
  5.     ElemType data;  
  6.     struct BiNode *lchild;  
  7.     struct BiNode *rchild;  
  8. }BiNode,*BiTree;  
  9. void preOrderCreateBiTree(){  
  10.     char ch;  
  11.     BiTree T;  
  12.     scanf("%c",&ch);  
  13.     if (ch=='#'){  
  14.         T = NULL;  
  15.     }  
  16.     else{  
  17.         T = (BiTree)malloc(sizeof(BiNode));  
  18.           
  19.     }