I am new to C. Here is my "Hello,world!" program.
Last login: Tue Sep 1 23:19:47 on ttys000
MacBook-Pro-MacBook:~ macbook$ /Users/macbook/Desktop/peng/Untitled1
-bash: /Users/macbook/Desktop/peng/Untitled1: Permission denied
First save your program as
Now you need the compiler, so you need to go to App Store and install
Xcode which is Apple's compiler and development tools. It looks like this:
Then you need to install the command-line tools with this command in Terminal. This allows you to simply run
gcc as in the next line without having to fire up the big, ugly software development GUI called
Then you can compile your code with
gcc -o program program.c
Then you can run it with
./program Hello, world!