C Programming Absolute Beginner's Guide (3rd Edition)

(Romina) #1
Note

An error in a computer program is called a bug. Getting rid of errors is called
debugging a program.

Take some time to explore Code::Blocks or whatever compiler you choose to install on your
computer. A robust IDE lets you perform these five steps easily, all from within the same
environment. You can compile your program, view any errors, fix the errors, run the program, and
look at the results, all from within the same screen and using a uniform set of menus.


Warning

If you have never programmed, this all might seem confusing. Relax. Most of today’s C
compilers come with a handy tutorial you can use to learn the basics of the compiler’s
editor and compiling commands.

Just in case you still don’t fully understand the need for a compiler, your source code is like the raw
materials that your computer needs. The compiler is like a machine that converts those raw materials
to a final product, a compiled program that the computer can understand.


Using C


C is more efficient than most programming languages. It is also a relatively small programming
language. In other words, you don’t have to learn many commands in C. Throughout this book, you
will learn about C commands and other elements of the C language, such as operators, functions, and
preprocessor directives.


Because of the many possible versions of C, a committee known as the American National Standards
Institute (ANSI) committee developed a set of rules (known as ANSI C) for all versions of C. As long
as you run programs using an ANSI C compiler, you can be sure that you can compile your C
programs on almost any computer that has an ANSI C compiler.


Tip

In 1983, ANSI created the X3J11 committee to set a standard version of C. This
became known as ANSI C. The most recent version of ANSI C, C11, was formally
adopted in 2011.

As soon as you compile a C program, you can run the compiled program on any computer that is
compatible with yours, whether or not the computer has an ANSI C compiler. “Great!” you might be
saying. “But when do I get to write my first C program, let alone compile or run it?” Fear not

Free download pdf