Chapter 27. C Programming

Secrets in This Chapter

  • The C Programming Environment

  • Starting a C Program

  • Using the C Language

The Linux world revolves around the C programming language. Many programs and utilities (including the core of the operating system) are written using the C language and distributed as C source code programs under the open-source environment. Therefore, it's crucial for any Linux system to include a C programming environment, and Ubuntu is no different. This chapter first walks through the C programming environment provided by Ubuntu, showing you the steps required to compile open-source applications written in C. The last section in the chapter walks through the C programming language and shows how you can create your own applications to run on your Ubuntu system. If you already know how to compile C programs in Ubuntu, feel free to skip to the last section.

C Programming in Ubuntu

Unlike shell scripts, Perl scripts, or Python scripts, C programs must be compiled before you can run them on the Ubuntu system. The compiling process reads and processes the C program code and creates an assembly language program to run on the system. Assembly language is the low-level programming language that runs directly on the microprocessor chip installed in the workstation.

The GNU Compiler

The GNU Compiler Collection (gcc) is the most popular development system for UNIX systems. Not only is it the default compiler for Linux and most open-source BSD-based systems (such as FreeBSD ...

Get Ubuntu® Linux® Secrets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.