で働くにはどうすればよい私がやるrand
とsrand
機能の仕組みを理解しようとしています:ランド/にsrand関数はC
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
int main(void)
{
unsigned int seed;
printf("please type in new seed:\n");
scanf("%i", &seed);
void srand(unsigned int seed);
int rand(void);
printf("%i\n", rand);
return 0;
}
しかし、私のコンパイラは言う:
形式
%i
は、型の引数を期待int
ですが、引数2はタイプがint (*)(void) [-Wformat=] printf("%i\n", rand);
ですe?
エラーは 'rand'と' srand'の両方に関係しません... –
あなたは関数と変数を混同しています。 – Barmar
そして、関数を*呼び出す*ときに、関数を宣言するための構文を使用しています。 – Barmar