CThe C programming language was invented in 1972 and has been a mainstay of computer science ever since. Many programmers are of the opinion that other languages are much more difficult to learn if you haven’t yet learned C.

**Learn the C Programming Language with this FREE online, on-demand course from Udemy**

This is a simple and reliable language, and you can start programming almost right away.  All you need to begin is a text editor and a compiler.

Finding the Right Text Editor

To code in C, programmers make use of a text editor or an IDE (integrated development environment) to create the program source code.  Here are some good options that you may want to explore:

  1. Vim – An advanced text editor, it is almost an IDE but not quite.
  2. Notepad++ – A free, lightweight source code editor with syntax highlighting. It is a step above the traditional Notepad program.
  3. Eclipse – A popular IDE available for many languages.
  4. Dev C++ – A full-featured IDE, with code completion and integrated debugging.

In the end, it is about finding an editor that you are comfortable with and seems easy to use.  The end results is the same – you will end up with a file, called the source code, with the extension .c.

Download and Install a Compiler

Once you get a text editor, you will then need to download and install a C compiler, which will transform the source code file into a format that the computer can read.

You can find a free compiler here, on the DevC++ website.

Once you’ve installed the compiler, you are ready to program.

Basic Data Types in C

A good course in C includes instruction in how to use the basic built-in data types, variables which can store a particular value.  Some of the basic variables used are:

  1. int – Specifies any integer number, which are whole numbers like 5 or 18.
  2. decimal – Specifies any decimal number, like 6.72.
  3. float – Specifies a floating-point value, a number with a potential decimal.
  4. double – Specifies a very large floating-point number, with twice the storage space for the number.
  5. char – Specifies characters, like ‘a’, ‘:’, or ‘-‘.
  6. string – A string of characters, like ‘hello’.
  7. object – Specifies an object.

These are some of the most commonly used variables which will be used in most programs.

Writing Some C Code

To write a bit of simple code, start by opening your text editor and beginning a new file.  We will use Dev C++ to create a program that will simply type out the message “My First C Program”

Open a new document, and at the top of your page, write ‘#include<stdio.h>’ and then return down two lines.  This tells the compiler to use the standard input/output files.

Then, type the following:

int main() {

printf(“My First C Program”);

return 0;

}

The ‘printf’ command tells the compiler to print out whatever is in the following parentheses.  The quotes are used because a string is being printed, but they are not necessary when printing data types such as int.

The ‘return 0;’ command tells the compiler to end the program here.

When you have finished typing, click ‘Execute’ on the top of the screen and then click ‘Compile’ and save the file.  Next, click ‘Execute’ and then click the ‘Run’ button to run the program.

You should see a box appear with the text of your program written in it. Congratulations!

For a more advanced lesson in how to learn C, and to find out what those extra symbols in the code mean, look into taking a high-quality, free programming course like Learn C Programming Language.

Top courses in C# (programming language)

Ultimate C# Masterclass for 2023
Krystyna Ślusarczyk
4.7 (986)
Bestseller
C# / .NET Interview Questions with Answers.
Shivprasad Koirala
4.7 (1,241)
Complete C# Unity Game Developer 3D
Ben Tristem, Rick Davidson, GameDev.tv Team, Gary Pettie
4.7 (40,221)
Bestseller
Learn Parallel Programming with C# and .NET
Dmitri Nesteruk
4.5 (3,520)
Bestseller
Unity RPG Inventory Systems Asset Pack: Behind The Scenes
GameDev.tv Team, Rick Davidson
4.5 (836)
The Unity C# Survival Guide
Jonathan Weinberger, Unity Technologies, GameDevHQ Team
4.7 (1,729)
Advanced Topics in C#
Dmitri Nesteruk
4.5 (545)
C#/.NET - 50 Essential Interview Questions (Mid Level)
Krystyna Ślusarczyk
4.8 (205)
Bestseller
Design Patterns in C# Made Simple
Zoran Horvat
4.7 (401)
Complete C# Masterclass
Denis Panjuta, Tutorials.eu by Denis Panjuta
4.6 (27,163)

More C# (programming language) Courses

C# (programming language) students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.

Request a demo