Jumat, 16 Januari 2009

C++



C++

What is C ?

C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.

Why is C popular?

In computing, C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.

Although C was designed for implementing system software, it is also widely used for developing application software.

It is widely used on many different software platforms and computer architectures, and several popular C compilers exist. C has greatly influenced many other popular programming languages, most notably C++, which originally began as an extension to C.


Areas of Use


C++ is used to develop applications in a number of different areas. Some of them are listed below:

* Commerce
* Education
* Marketing and Sales
* etc

History

The initial development of C occurred at AT&T Bell Labs between 1969 and 1973; according to Ritchie, the most creative period occurred in 1972. It was named "C" because many of its features were derived from an earlier language called "B", which according to Ken Thompson was a stripped-down version of the BCPL programming language.

The origin of C is closely tied to the development of the Unix operating system, originally implemented in assembly language on a PDP-7 by Ritchie and Thompson, incorporating several ideas from colleagues. Eventually they decided to port the operating system to a PDP-11. B's lack of functionality to take advantage of some of the PDP-11's features, notably byte addressability, led to the development of an early version of the C programming language.

The original PDP-11 version of the Unix system was developed in assembly language. By 1973, with the addition of struct types, the C language had become powerful enough that most of the Unix kernel was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly. (Earlier instances include the Multics system (written in PL/I), and MCP (Master Control Program) for the Burroughs B5000 written in ALGOL in 1961.)

The Advantages

-Compiled language - always runs fast.
-Standardized language (ANSI)- easier to port to different compilers / target devices.
-Many compilers available.
-Many in built functions (depending on compiler).
-Very popular – large user base with many example programs.
-Used in many different industries.
-Usable at the hardware level as well as higher abstraction levels (although C++ is better for very abstracted programming models).

The Disadvantages

-Hard to learn at first.
-Strong type checking means you spend time pleasing the compiler (although this protects you from making errors).


The Syntax

long int SomeFunction();

/* int OtherFunction(); */



/* int */ CallingFunction()

{

long int test1;

register /* int */ test2;



test1 = SomeFunction();

if (test1 > 0)

test2 = 0;

else

test2 = OtherFunction();



return test2;

}

Tidak ada komentar:

Posting Komentar