15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The History of Computer Programming 15<br />

manipulate the processor) and high-level languages (which isolate you from<br />

the details of manipulating the processor), computer scientists created an<br />

intermediate language dubbed C.<br />

Book I<br />

Chapter 1<br />

The idea behind the C <strong>programming</strong> language is to give programmers the<br />

ability to manipulate the processor directly like assembly language, but also<br />

give you the chance to ignore these technical details, if you want, like a highlevel<br />

language.<br />

As a result, a C program doesn’t look as cryptic as assembly language, but<br />

also isn’t as easy to read as a high-level language, as the following C program<br />

demonstrates:<br />

Getting Started<br />

Programming a<br />

Computer<br />

#include <br />

int main(void)<br />

{<br />

printf(“Hello World!\n”);<br />

exit(0);<br />

}<br />

Just by looking at this C program, you can probably figure out that it prints<br />

Hello World! on the screen. However, you might see a bunch of cryptic<br />

curly brackets, back slashes, and other odd symbols and characters that<br />

may make no sense whatsoever. Don’t worry. Just notice how confusing C<br />

programs can look while at the same time being somewhat understandable.<br />

Because C lets you directly control the processor like assembly language, but<br />

still write programs that look somewhat understandable and easy to read and<br />

write, most major programs, such as operating systems like Microsoft Windows,<br />

Linux, and Mac OS X, are written in C.<br />

Pros and cons of <strong>programming</strong> languages<br />

The whole purpose of machine language, assembly language, high-level language,<br />

and the C language is to give you different ways to give instructions to<br />

the processor (computer). Ultimately, it doesn’t matter which type of <strong>programming</strong><br />

language you use because it’s possible to write the exact same program in<br />

machine language, assembly language, a high-level language (like BASIC or FOR-<br />

TRAN), and C.<br />

The only difference is that writing a program in machine language takes a<br />

really long time and is very difficult to write, fix, and understand. A similar<br />

program written in assembly language is smaller and simpler than an equivalent<br />

machine language program.<br />

Writing the same program in the C language makes the program even smaller<br />

and much easier to write and understand. If you use a high-level language, the<br />

program would most likely be the smallest and easiest to understand out of<br />

them all.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!