Originally Posted by
Gareth Morgan
however I think Ive written it down wrong as its doesnt compile.
And why don't you tell us the errors you get?
Code:
$ make foo
cc -ggdb3 -Wall -Wextra foo.c -o foo
foo.c:5:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
foo.c: In function ‘main’:
foo.c:12:10: warning: implicit declaration of function ‘getch’ [-Wimplicit-function-declaration]
/tmp/cc3YI3U1.o: In function `main':
/home/andreas/Code/foo.c:12: undefined reference to `getch'
collect2: ld returned 1 exit status
make: *** [foo] Error 1
There is no standard function called getch(). You're probably on Windows/DOS and want to use a function with that name declared in <conio.h>, so you have to include this header.
Bye, Andreas