Home
Programming
AspectJ   Basic   C   C++   C#   Eiffel   Java   JavaScript   Pascal   PHP   Python   Rexx   Ruby   Scriptol   Tcl
Markup
HTML   XML   XAML   XUL
Query
SQL

C - System Programming

The C language was originally designed from 1969 to 1972, by Dennis Ritchie to program the Unix operating system.
The goal of C was to be portable.

C Features

A C program is a set of functions that return or not a value, and global variables.
Functions and variables have prototypes in header files for external use.
The programmer must manage itself the memory, using pointers and functions to allocate of free fields of memory.
It is portable with some restrictions, additional variable types for exemple, are specific to compilers.

Why to use it?

C has known success thanks to the liberty if offers to programmers. The drawback is the difficulty to debug the programs. It is fast, and a large collection of APIs is available.

Description of the C language

Data structures:

Scalars (int, long, char, char *, etc...), struct, union, typedef.

Control structures:

Some symbols:

// and /* */ comments.
& | && || logical operators.
# directive to the pre-processor.

The while loop:

while(x < y)
{
   ... statements ...
}

Defining a function:

int name(char *x, int y)
{
   ... statements ...

   return(z);
}

C Sites and tools

Libraries

Sample code

Merging and displaying lists
string s = "demo" + "trail";
int l = s.length();
for(int i = 0; i < l; i++)
{
   char c = s[i];
   printf("%c\n", c);
} 
Home