我目前正在学习C"C傻瓜的一体化桌面参考",并开始教授如何获取随机数.但是,它提供的示例代码不起作用(编译器出现错误"未定义引用'随机'").我的代码如下,从书中复制.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int hat;
hat = random();
printf("%d is a random number.\n",hat);
return(0);
}
Run Code Online (Sandbox Code Playgroud)