Inflearn brand logo image

Inflearn Community Q&A

hethegrace03101189's profile image
hethegrace03101189

asked

C Programming - From Introduction to Game Development

Project

Error with random number (in Xcode)

Written on

·

282

0

srand(time(NULL);

이거 선언할 때마다 에러가 납니다. # include <time.h>를 추가해도 똑같습니다. Xcode에서는 random number를 구할 때는 다른 코딩을 쓰나요? 구글링해도 잘 안나오네요 왜 에러가 나는지도 모르겠고요.. 에러는 conflicting types for 'srand'라고 나옵니다..

c

Answer 1

3

srand 를 실행하기 위한 헤더 파일은 stdlib.h 이기 때문에

#inclue <stdlib.h> 를 추가하시면

srand(time(NULL)); 이 정상적으로 실행되어질 겁니당.

hethegrace03101189's profile image
hethegrace03101189

asked

Ask a question