Blog Post, Programming, Tutorials

Creating Your First C Program: Quickstart

Many can relate to the challenge of learning a new coding language. I’ve found that quickly being able to make a first program to start experimenting with the language helps inspire the confidence needed to keep going. In this blog post I will be briefly going over the steps needed to create a simple first program in the C language in Ubuntu.

Setting Up Your Development Environment On Your Computer:

  1. Install your favorite text editor; mine happens to be VS Code by Microsoft.
  2. Know how to use the cd and ls commands in the terminal to access the files you will be creating.

C is a compiled language which means that once you have written the .c file you will need to “compile” it which will create another file which the computer will use to run the program.

To install the GCC C compiler on your computer run:

To Create Your First Program:

Create a File with the .c file extension in your text editor. Below is a sample first C file.

To Compile Your First Program:

Move to the directory that contains your program and type:

This code has two important effects, it runs the gcc compiler and creates and names an object file from your program file.

To Run Your First Program:

In the same directory, type:

Please let me know if this helped you to get started quickly with C on Linux.

Blog Post, Programming, Tutorials

Creating your First Clojure Program in Linux

Those who really want to start learning a language will find it easier to start learning the language by setting up a REPL as fast as possible. This makes it easy to experiment with some simple expressions. This post will covers the installation of Clojure and an editor on Ubuntu Linux to set up a REPL.

Since Clojure runs on the Java Virtual Machine, one will need to install Java on your system. This, Here, is an easy way to do exactly that.

Now that Java is installed, one can install leiningen, a helpful tool for managing Clojure projects, especially when starting with Clojure.

To Install Leiningen:

Use Ubuntu’s package manager:

Or use wget:
wget puts files in your current working directory, which is home by default.

Installing a text editor:

Many people like using slime emacs for Clojure development, but for people who haven’t used emacs before I suggest using Nightcode. It is easier not to have to learn Clojure and a complex text-based editor like emacs at the same time. For this reason, Nightcode is a good alternative.

To install Nightcode download the .deb file and double click on it to open a window with the option to install it on your system.

Creating a New Leiningen Project:

In the terminal type:

Lastly, open the project in Nightcode. A “Hello World!” console application is already generated for you.