An easy way to test C code without uploading onto a microcontroller is to run it directly on your computer. An IDE is not necessary, you can compile and run directly from the command line!
For Windows, we recommend gcc from MinGW.
For Mac, we recommend Xcode.
Go to the MinGW homepage and click the "Download Installer" button in the top right of the screen.
This will take you to a sourceforge.net link. You do not have to click anything here (it's all ads), the download will start automatically after 5 seconds.
Click install. Let the files be saved in C:\MinGW, and say Continue.
It will take a minute to install. When it is complete, click Continue.
This will bring you to the MinGW Installation Manager, where you select the Package you want to install. We are only interested in gcc, not fortan or g++ or any of that, so select 'mingw32-base' and say 'Mark for installation'. In the top left, click Installation -> Apply Changes, and click apply in the pop-up window.
This will download the package, extract and install gcc. When complete, click Close.
You can close the Installation Manager.
Verify that you have gcc.exe installed by opening C:\MinGW\bin.
Before we compile code, we need to tell Windows where to find gcc.exe. Open the Control Panel, and click System and Security, click System, and click on Advanced system settings.
Click the Environment Variables... button.
Under System variables, find Path.
Click Edit..., and at the end, add C:\MinGW\bin; and say OK to all the windows.
Now we can compile some code! In Windows, I like to use Notepad++ as a text editor. Here I have saved our HelloWorld code as hello.c in C:\example.
Now I can open the Command Window (cmd.exe), use 'cd' to change the directory to C:\example, use 'dir' to verify that hello.c is there, and use 'gcc' to compile the code (gcc hello.c -o hello). This creates hello.exe, so if I type 'hello', the code runs, and I see "Hello World!"
Now you are ready to start coding.
Xcode is the Mac IDE for creating programs and apps for the Mac environment. It does not come pre-installed, so you have to download and install it.
Go to the Xcode page and click View in Mac Apple Store.
And again click View in Mac Apple Store. This will bring up the App Store where you can download Xcode.
Click Free, and then click Install App. Sign in with your Apple ID and password, and the Install App button will say "Installing." You can follow a progress bar in the Finder under Applications -> Xcode. It will take a while.
When it is installed, run Xcode and agree to the terms. Go to Xcode -> Preferences, and select the Downloads tab. Download the Command Line Tools.
Then close Xcode, because we will use the command line version of the compiler, not the IDE.
Open TextEdit, and go to Format -> Make Plain Text. Now you can save the file with a .c extension. Copy the Hello World! code and save.
Open Terminal from Applications -> Utilities -> Terminal. You can see where you are by typing the command 'pwd'. You can see the contents of the folder using 'ls'. Navigate to the folder with hello.c using 'cd', and compile the code with 'gcc hello.c -o hello'. Verify that the program hello is there, and run it with './hello'.
Now you can start writing your own code!