"C" is a programming language.
"C" is THE programming language! :-) It is the language
in which both the most powerful hacker exploits, most Unix type
operating systems and very much of the programs, which you can
get for free from internet sites, are written.
The power of "C" is like the
power of a fast car: Use it carefully and sensibly and you will
be a winner. Use it without any knowledge and control and you
will go off-road, next to a tree.
More seriously: The design of "C"
lets you make things not possible in other programming languages.
"C" is the programming language for those of you, who
want to gain control over the whole thing, to break into computers,
or to keep the bad guys out of your computer. "C" gives
YOU, the programmer, the full responsibolity, what will happen.
OK, there are traps inside "C".
And you WILL fall over them. But, hey, we are learning from errors,
we are hackers, so we want to learn, cause we are curious, therefore,
there is no better way for us to learn than to make errors. The
only error which should not be made is the error of avoiding
errors... :-)
This tutorial will introduce the programming language C to
you and it want to makes you a little bit curious. It is far
beyond the scope of it to TEACH you C. If you want to learn C
seriously, buy a good book about C. My favourite one is written
by the inventors of C, Brian W. Kerningham and Dennis M. Ritchie
and is called "The C Programming Language".
All example programs given in this tutorial,
are written for an ANSI-type of compiler. But in the following
you will find tips, how to change the source codes easily, so
that they will compile on K&R types of compilers without
errors. You mainly have to change the beginning of the function
definitions and their prototypes a little bit.
Happy learning, Happy Hacking!
Let's start the story to tell.....
### 2.0 What do we need to program in C?
----------------------------------------------------------------------
First, let's see whether your account is prepared for you
to program in C!
Log into your account and type:
cc
Or if this gives the result "command not found",
try:
gcc
. This will call a program called "C compiler" (that's
why the command is called "cc"). Note:
if "gcc" works instead of "cc", then for
the rest of this C porgramming guide substitute "gcc: everywhere
you see "cc".
If you have a C compiler you will get an error message
(that's quite normal!) but at least you don't get the message
"command not found", whihc means you don't have a C
compiler. If that is the case, get an account with an installed
C compiler. For a list of Internet service providers
around the world that you can use to search for one that offers
a shell account with a C compiler, see http://www.celestin.com/pocia.
Or, better: Install LINUX (it is not that hard! If you are
able to install Windoze, you are able to install LINUX!), then
install gcc, the GNU C compiler, available from http://www.gnu.org.
You have a C compiler installed at your account? Fine! But....what
IS a C compiler?
Do you remember ancient times, when hackers
used hex-editors and cryptic tables of "foreign number codes"
to write very very very fast and short programs? You don't?
OK, too bad you aren't old like us:) Anyhow, those programs were
called "assembler" programs. "Assembler"
is the native language of the central processing unit (CPU) of
your computer. Because the
only thing which is important for assembly language is to be
fast and readable by the CPU of your computer, it is made of
a nothing more than a bunch of NUMBERS.
But then people (not only hackers) wanted
to write programs which were easy to for humans to understand.
So they invented the "compiler languages". These languages
were made from words (commands) instead of numbers. Now
humans could read those words, but CPUs couldn't.
Wrong design?
Not really, because some egg heads also
invented programs called "compilers". Each programming
language need its own compiler. The task of these compilers
is to translate the words into assembly language. The input to
a compiler is a text file consisting of a (more or less) logical
sequence of words, the commands which the programmer has written.
This text file is
called the "source code", because it is the "source"
of the program. The result of a run of a compiler is another
file, called an "executable program". An "executable
program" is one which you can run just by typing in its
name. Have you ever tried to run those computer break-in
programs you find in places like http://www.rootshell.com?
If you type in the name of a file that holds C source code, it
just sits there and does nothing. You have to compile it before
you can run the program.
"Programming" means to divide a task into smaller
and pieces until these pieces can be expressed by a sequence
of commands.
Click here for more --->