C Tutorial (1) : Programming Basics

What is a Program

A computer isn’t smart. It will obey your instructions. Your computer will sit for days processing the data you supply, without getting bored or wanting overtime pay 🙂 .

The computer can’t decide what to do on its own. Computers can’t think for themselves, so programmers (people who tell computers what to do) must give computers extremely detailed instructions. Without instructions, a computer is useless.

The collection of detailed expressions that you supply when you want your computer to perform a specific task is known as a program.

Note : If you mistype code or skip a step, your program will/may not work.

Some basic terms in Programming

Compiler : Before you can write and execute a C program on your computer, you need a C compiler. The C compiler takes the C program you write and builds or compiles it (technical terms for making the program computer-readable), enabling you to run the compiled program when you’re ready to look at the results.

Open source : Generically, open source refers to a program in which the source code is available to the general public for use and/or modification from its original design free of charge, i.e., open. Open source code is typically created as a collaborative effort in which programmers improve upon the code and share the changes within the community.

Cross Platform : A platform is a computer hardware and software combination on which a program runs.  A platform is a combination of both software and hardware resources. Cross-platform is an adjective that means the software can run on different operating systems. In a sense, it means that a code is able to run on multiple frameworks, platforms, operating systems and machine architectures.
There are many factors that cause the language or tool to be able to run on multiple machines and platforms. Compiler, language used, statements and resource consumption is one of these things that you should consider while programming.
For example, C and C++ code is cross-platform because the compiler translates the code to Assembly language for the architecture of the machine being used.

IDE : IDE is short for integrated development environment, which just means you can write, edit, and debug your programs without having to switch software to do so.

The C program you write is called source code. A compiler translates C source code into machine language. Computers are made up of nothing more than thousands of electrical switches that are either on or off . Therefore, computers must ultimately be given instructions in binary. The prefix bi- means “two,” and the two states of electricity are called binary states. It’s much easier to use a C compiler to convert your C programs into 1s and 0s that represent internal on and off switch settings than for you to do it yourself.

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.

The Programming Process

  1. Decide exactly what the program should do.
  2. Use an editor to write and save your programming language instructions.
  3. Compile the program.
  4. Check for program errors. If any appear, fix them and go back to step 3.
  5. Execute the program.

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

ANSI C

C is more efficient than most programming languages. It is also a relatively small programming language.

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.

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.

Assignment : Download a C IDE and explore all its options.

                                                                                    Next> Your first C Program

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s