问个头文件alloc.h问题
#include<stdio.h>
#include<stdlib.h>
#include<alloc.h>
#define MALLOC(num,type) (type*)alloc((num)*sizeof(type))
void main()
{
int *new_memory;
new_memory = MALLOC(1,int);
*new_memory = 1;
printf("%d\n",*new_memory);
}
书上说有这个头函数的,为什么这现在使用时却报错
fatal error C1083: Cannot open include file: 'alloc.h': No such file or directory
大概就是说没这个头函数吧. 为什么会这样呢? 不太清楚这个,莫非这书中的c语言不是c99的?
一般是用stdlib.h中的malloc(size_t size)吧。 LZ大大读的是TC的书吗? 好像是C和指针吧 TC的才有这个文件。VC的话使用malloc.h 即可。
页:
[1]