alloc.h的源代码是:
/* alloc.h  
   
  memory   management   functions   and   variables.  
   
  Copyright   (c)   Borland   International   1987,1988  
  All   Rights   Reserved.  
  */  
  #if   __STDC__  
  #define   _Cdecl  
  #else  
  #define   _Cdecl cdecl  
  #endif  
   
  #ifndef   _STDDEF  
  #define   _STDDEF  
  #ifndef   _PTRDIFF_T  
  #define   _PTRDIFF_T  
  #if defined(__LARGE__)   ||   defined(__HUGE__)   ||   defined(__COMPACT__)  
  typedef   long ptrdiff_t;  
  #else  
  typedef   int ptrdiff_t;  
  #endif  
  #endif  
  #ifndef   _SIZE_T  
  #define   _SIZE_T  
  typedef   unsigned   size_t;  
  #endif  
  #endif  
   
  #ifndef   NULL  
  #if   defined(__TINY__)   ||   defined(__SMALL__)   ||   defined(__MEDIUM__)  
  #define   NULL 0  
  #else  
  #define   NULL 0L  
  #endif  
  #endif  
   
  int _Cdecl   brk (void   *addr);  
  void *_Cdecl   calloc (size_t   nitems,   size_t   size);  
   
  #if   defined(__COMPACT__)   ||   defined(__LARGE__)   ||   defined(__HUGE__)  
  unsigned   long   _Cdecl   coreleft (void);  
  #else  
  unsigned   _Cdecl   coreleft (void);  
  #endif  
   
  void   _Cdecl   free (void   *block);  
  void *_Cdecl   malloc (size_t   size);  
  void *_Cdecl   realloc (void   *block,   size_t   size);  
  void *_Cdecl   sbrk (int   incr);  
   
  #if   !__STDC__  
  void   far     *   _Cdecl   farcalloc (unsigned   long   nunits,   unsigned   long   unitsz);  
  unsigned   long   _Cdecl   farcoreleft(void);  
  void   _Cdecl             farfree (void   far   *block);  
  void   far     *_Cdecl   farmalloc (unsigned   long   nbytes);  
  void   far     *_Cdecl   farrealloc (void   far   *oldblock,   unsigned   long   nbytes);  
  #endif  

    在这里需要解释的是:头文件alloc.h和malloc.h的作用和内容基本相同,但前者供Borland C++编译程序使用,后者供Microsoft C++编译程序使用。如果你在编写一个既支持Borland C++又支持Microsoft C++的程序,你就应该指定在编译时是包含alloc.h头文件还是包含malloc.h头文件。
    在使用malloc()函数时,写上头文件alloc.h,在vc下编译后,报错:fatal error C1083: Cannot open include file: 'alloc.h': No such file or directory
    这是因为:VC下是不包含alloc.h头文件的,你可以加上stdlib.h或malloc.h头文件,这两个头文件里面都有malloc函数的声明,以及free、realloc函数的声明。
    或者你也可以将alloc.h中的void  _FAR *_Cdecl malloc(size_t __size);修改为void  *_cdecl malloc(size_t __size);加在main函数的前面,如:
void  *_cdecl malloc(size_t __size);
void main(void)
{
 char *p = (char *)malloc(2*sizeof(char));
}
注:我这里的alloc.h是取自TC++3.1中的。
    你也可以将TC++3.1下的INCLUDE目录加到VC下的菜单 Tools->options->Directories->Show directories for下面,选择Include files选项,把上面的INCLUDE目录加到这里就可以了。不过要去掉里面的一些关键字,如huge、_FAR等。所以不如直接加stdlib.h或malloc.h头文件方便。