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.

Chapter 1: C and C++<br />

In This Chapter<br />

Understanding the structure of a C/C++ program<br />

Declaring variables, data types, and values<br />

Using mathematical operators<br />

Branching and looping statements<br />

Creating data structures and objects<br />

The C language focuses on simplicity. Whereas other <strong>programming</strong> languages<br />

include a large numbers of keywords, the C language consists<br />

of a much smaller number of keywords. As a result, creating C compilers is<br />

relatively easy compared to creating compilers <strong>for</strong> other <strong>programming</strong> languages,<br />

which means that C compilers are easy to write <strong>for</strong> every operating<br />

system. This makes it easier to transfer, or port, C programs from one computer<br />

to another.<br />

Because the C language consists of relatively few keywords, it lacks features<br />

commonly found in other <strong>programming</strong> languages, such as offering a string<br />

data type. To compensate <strong>for</strong> its relative sparseness of features, most C<br />

compilers include a variety of library files that contain pre-written C code<br />

that adds these useful features to the C language. The main problem with<br />

C compilers is that every C compiler tends to offer different library files,<br />

so a C program designed to run on Windows may not run correctly with a<br />

different C compiler on Linux.<br />

The C++ language builds on the C language by adding object-oriented features<br />

while retaining the C language’s hardware access, speed, and portability.<br />

Most large and complicated programs, such as operating systems, are<br />

written in C++.<br />

Because C/C++ gives complete access to all parts of the computer, a mistake<br />

in a C/C++ program can wipe out data off a hard disk or crash the entire<br />

operating system of the computer. Writing C/C++ programs may be easy, but<br />

understanding and fixing C/C++ programs can be difficult.<br />

Despite these problems, C/C++ is heavily used throughout the computer<br />

industry. To understand <strong>programming</strong>, you must become familiar with the<br />

C/C++ <strong>programming</strong> language.

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

Saved successfully!

Ooh no, something went wrong!