Sie sind auf Seite 1von 9

History or Evolution of C

Programming languages are used to specify, design, and build software systems.

C evolved from two previous languages, BCPL and B.


BCPL(the Basic Combined Programming Language) was developed in 1967 by Martin Richards as
a language for writing operating-systems software and compilers.
UNIX was developed at around 1969. It first version was programmed in assembler and run
on a DEC PDP-7.
The second version was ported to a PDP-11 in 1971 and it was a great success:
16 KB for the system
8 KB for user programs
disk of 521 KB
limit of 64 KB per file
While writing a FORTRAN compiler for UNIX, a new programming language was developed: B
B, a descendant of BCPL was written by Ken Thompson.

Ken Thompson modeled many features in his B language after their counterparts in BCPL,
and in 1970 he used B to create early versions of the UNIX operating system on the DEC PDP-7
at Bell Laboratories.
B was interpreted (like Java) and, therefore, slow. To solve the performance problems of B, a
new language was
created: C
allowed generation of machine code (compilation)
declaration of data types
definition of data structures

BCPL and B are ''typeless'' languages every data item occupied one word in memory, and
the burden of typing variables fell on the shoulders of the programmer . By contrast, C provides
a variety of data types.
C was developed in the early 1970s at AT&T Bell Laboratories in Murray Hill, New Jersey, for the
purpose of implementing the Unix operating system and utilities with the greatest possible degree of
independence from specific hardware platforms..
C was originally designed for and implemented on the UNIX operating system on the DEC PDP-11
computer in 1972, by Dennis Ritchie.

C initially became widely known as the development language of the UNIX operating system.
Today, virtually all new major operating systems are written in C and/or C++. C is available
for most computers.
C is mostly hardware independent. With careful design, its possible
to write C programs that are portable to most computers.
By the late 1970s, C had evolved into what is now referred to as traditional C.
In 1973 UNIX was rewritten in C something that was never done before
is much easier to handle than assembler but
C
first C version of UNIX was 20 to 40 % larger and slower than assembler version
Until the past few years, no absolute standard for the C language existed. The C Programming
Language, by Kernighan and Ritchie, served as a standard, but most compiler manufacturers added
extensions and did not follow all the specifications presented by Kernighan and Ritchie. The rapid

expansion of C over various types of computers (sometimes called hardware platforms) led
to many variations that were similar but often incompatible. As C became one of the most
popular computer languages for programming small computers, the need for a true standard became
apparent.
The American National Standards Institute (ANSI) produced standards that help keep each of the
compilers working in the same manner. These standards, which are very exacting, spell out exactly
what the language should do and what should not happen. Specified limits and definitions exist also.
Brian Kernighan and Dennis Ritchie published an official description of the C programming language in
1978. As the first de facto standard, their description is commonly referred to simply as K&R.
The second edition, revised to reflect the first ANSI C standard, is available as The C
ProgrammingLanguage, 2nd ed., by Brian W. Kernighan and Dennis M. Ritchie (Englewood Cliffs, N.J.:
Prentice Hall, 1988).
WHAT IS THE ANSI-C STANDARD?
When it became evident that the C programming language was becoming a very popular language
available on a wide range of computers, a group of concerned individuals met to propose a standard
set of rules for the use of the C programming language. The group represented all sectors of the
software industry and after many meetings, and many preliminary drafts, they finally wrote an
acceptable standard for the C language. It has been accepted by the American National Standards
Institute (ANSI), and by the International Standards Organization (ISO). It is not forced upon any group
or user, but since it is so

widely accepted, it would be economic suicide for any compiler writer to refuse to conform to the
standard.
See also
C how to program
Test your skills in c
c complete reference
wikipedia

Features of C

As a result, the developers of Unix were able to write most of the operating system in C, leaving only a
minimum of system-specific hardware manipulation to be coded in assembler.
It has been called a ''system programming language'' because it is useful for writing compilers and
operating systems. The operating system, the C compiler, and essentially all UNIX applications
programs are written in C. it allows the direct manipulation of bits, bytes, words, and pointers.

This makes it well suited for system-level programming, where these operations are
common. Because C was expressly designed for system programming, it is hardly surprising that one
of its major uses today is in programming embedded systems.

C code is also very portable.


Portability means that it is easy to adapt software written for one type of computer or
operating system to another type. For example, if you can easily convert a program written
for DOS so that it runs under Windows 2000, that program is portable.
At the same time, however, many developers use C as a portable, structured high-level language to
write programs such as powerful word processor, database, and graphics applications.
C is considered a mid-level language. This does not mean that C is less powerful, harder to

use, or less developed than a high-level language such as BASIC or Pascal, nor does it imply
that C has the cumbersome nature of assembly language (and its associated troubles). In C,
you get the best of the high-level programming languages and the speed of development they offer,
and you also get the compact program size and speed of a low-level language. In short,

It has high-level constructs.


It can handle low-level activities.

As a middle-level language, C allows the manipulation of bits, bytes, and addresses the
basic elements with which the computer functions.
All high-level programming languages support the concept of data types.
Although C has several builtin data types, it is not a strongly typed language, as are
Pascal and Ada. C permits almost all type conversions. For example, you may freely intermix
character and integer types in an expression. So, C is called loosely typed language.
Unlike most high-level languages, C specifies almost no run-time error checking. For
example, no check is performed to ensure that array boundaries are not overrun. These
types of checks are the responsibility of the programmer.
C does not demand strict type compatibility between a parameter and an argument. As you
may know from your other programming experience, a high-level computer language will
typically require that the type of an argument be (more or less) exactly the same type as the
parameter that will receive the argument. Such is not the case for C. Instead, C allows an
argument to be of any type so long as it can be reasonably converted into the type of the
parameter. Further, C provides all of the automatic conversions to accomplish this.
C is not , technically , a block-structured language is that blockstructured languages permit procedures or
functions to be declared inside other procedures or functions. However, since C does not allow the creation of
functions within functions, it cannot formally be called block-structured.

C is a general-purpose, procedural programming language.


C is a structured language. The distinguishing feature of a structured language is

compartmentalization of code and data. This is the ability of a language to section off and
hide from the rest of the program all information and instructions necessary to perform a
specific task. One way that you achieve compartmentalization is by using subroutines that
employ local (temporary) variables. By using local variables, you can write subroutines so
that the events that occur within them cause no side effects in other parts of the program.
This capability makes it very easy for your C programs to share sections of code. If you
develop compartmentalized functions, you need to know only what a function does, not how
it does it. Remember, excessive use of global variables (variables known throughout the
entire program) may allow bugs to creep into a program by allowing unwanted side effects.
A structured language offers a variety of programming possibilities. For example, structured
languages typically support several loop constructs, such as while, do-while, and for. In a
structured language, the use of goto is either prohibited or discouraged and is not the
common form of program control. A structured language allows you to place statements
anywhere on a line and does not require a strict field concept.
Another way to structure and compartmentalize code in C is through the use of blocks of
code. A

code block is a logically connected group of program statements that is treated as a unit. In
C, you create a code block by placing a sequence of statements between opening and
closing curly braces. In this example,
if (x < 10) {
printf(''Too low, try again.\n");
scanf("%d", &x);
}
Cis a programmers language.

LANGUAGE LEVELS
Programming languages have different levels, depending on how much they resemble human
languages. Programming languages that use common words and are relatively easy for most folks to
read and study are called highlevel languages. The opposite of those are low-level languages, which
are not easy to read or study.
High level languages are like English, and all its commands and instructions are English words or at
least English words missing a few vowels or severely disobeying the laws of spelling.
The lowest of the low-level programming languages is machine language. That language is the actual
primitive grunts and groans of the microprocessor itself. Machine language consists of numbers and
codes that the microprocessor understands and executes. Therefore, no one really writes programs in
machine lan guage; rather, they use assembly language, which is one step above the low-level
machine language because the grunts and groans are spelled out rather than entered as raw
numbers.
Why would anyone use a low-level language when high-level languages exist?
Speed! Programs written in low-level languages run as fast as the computer can run
them, often many times faster than their high-level counterparts. Plus, the size of the program is
smaller.
On the other hand, the time it takes to develop an assembly language program is much longer than it
would take to write the same program in a higher-level language. Its a trade-off.

Structure of a C program
A

C program contains the following elements:


Preprocessor Commands

Type definitions
Function prototypes -- declarations of function types and arguments.
Variables
Functions
All

programs must contain a single main() function.

All function, including main, have the following format:


type function_name (parameters) {
local variables
C Statements
}
#include <stdio.h>
#define TIMES 10 /* upper bound */
double myfunction(float);
/* Function prototype - Declaration */
main() {
double wert;
double pi = 3.14;
printf(Multiply by 10\n);
wert = myfunction(pi);
printf(%d * %f = %f\n,
TIMES, pi, wert);
}
double myfunction(double zahl){
int i;
double count = 0;
count = TIMES * zahl;
return count;
}

Winner of the international Obfuscated C Code Contest http://reality.sgi.com/csp/iocc


#include <stdio.h>
main(t,_,a)
char *a;
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
:t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
+1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
CHARACTER SETS

Refer :
C in a Nutshell
wikipedia
tokens
Refer :
C in a Nutshell
Keywords and Identifiers
The keywords can also be referred to as reserved words.
Each of the keywords has its own set of problems. You dont just use the keyword else, for example;
you must use it in context.

All C programs consist of one or more functions. As a general rule, the only function that
must be present is called main( ), which is the first function called when program execution
begins. In wellwritten C code, main( ) contains what is, in essence, an outline of what the
program does. The outline is composed of function calls. Although main( ) is not a keyword,
treat it as if it were. For example, don't try to use main as the name of a variable because
you will probably confuse the compiler.
Refer :
C in a Nutshell
Wikipedia

Even more keyword madness!


Refer:
C for dummies
comments
Refer :
C in a Nutshell
Breaking up lines\ is easy to do
Refer :
C for dummies
C Library
Refer :

C how to program
wikipedia
Compilers vs. Interpreters
The

Preprocessor accepts source code as input and


removes comments
extends the code according to the preprocessor directives included in the source code (lines
starting with #)
The Compiler takes the output of the preprocessor and produces assembly code
The Assembler takes the assembly code and produces machine code (or object code)
The Linker takes the object code, joins it with other pieces of object code and libraries and
produces code that can be executed

Refer :
C complete ref
C in a Nutshell
Practical c programming
MS C bible

Chapter 2

C of Sorrow, C of Woe
Refer :
C for dummies
C's Memory Map
Refer :

C complete ref
Video: C Programming Tutorial 1 - Memory Layout of a C _ C++ Program - Think Aloud Academy YouTube.webm
Types, Literals and Type Conversions

The sizes of the data types are not standardized (depend on the
implementation)
Refer :
C in a Nutshell

Das könnte Ihnen auch gefallen