Définir un langage algorithmique procédural, permettant de programmer les couches basses du système.
Instructions préprocesseur avec #
Séparation .h
et .c
Un exemple de programme C est :
<strong>#include</strong> <stdio.h><br> <br> <span class="codeComment"><strong>/*</strong> Demande à l'utilisateur un nombre entre 1 et 10 <strong>*/</strong></span><br>
<strong>int </strong>Get_X<strong>() {<br> int </strong>x<strong>;<br> <br> do<br> {<br> </strong>printf
<strong>(<span class="codeString">"\n</span></strong><span class="codeString">Entrez un
nombre entre 0 et 10 <strong>"</strong></span><strong>);<br> </strong>scanf<strong> (<span class="codeString">"%d"</span>, &</strong>x<strong>);<br> <br> } while (</strong>x<strong>
< </strong>0<strong> || </strong>x<strong> > </strong>10<strong>);<br> <br> return
(</strong>x<strong>);<br> } <br> <br> main</strong>() <strong>{</strong><br> <strong>int </strong>c, c1; c =
c1 = 0;<br> <strong>while </strong>((c = getchar()) != EOF)<br> <strong>{</strong><br> <strong>if </strong>(c !=
<span class="codeString">' '</span> && c != <span class="codeString">'\t'</span> && c != <span class="codeString">'\n'</span>)<br>
printf ("%c", c);<br> <strong>else</strong><br> <strong>if</strong> (c1 != <span class="codeString">' '</span> &
c1 != <span class="codeString">'\t'</span> && c1 != <span class="codeString">'\n'</span>)<br> printf (<span class="codeString">"\n"</span>);<br> <br> c1 = c;<br> <strong>}<br> }</strong>
Un exemple de compilation C est :
<strong>cc</strong> MonSource.c
ou avec un compilateur GNU/Linux :
<strong>gcc</strong> MonSource.c
=+,
=*, etc.), ce qui introduisait une ambigüité pour des expressions du type
x=-y).
Version | Commentaire | |||
---|---|---|---|---|
Release | ||||
Fix | ||||
Couche | Technologie | Maintenance | Description | |
Types | Texte | char |
Caractère ASCII | |
char* |
Pointeur sur suite de char | Chaîne à zéro terminal | ||
Numériques | char |
8 bits signés (-128 à 127) | ||
unsigned char |
8 bits non signés (0 à 255) | |||
int |
16 bits signés (-32768 à 32767) | |||
unsigned int |
16 bits non signés (0 à 65535) | |||
long int |
32 bits signés (-2147483648 à 2147483647) | |||
unsigned long int |
32 bits non signés (0 à 4294967295) | |||
float |
32 bits | Précision à 6 décimales | ||
double |
64 bits | Précision à 10 décimales | ||
long double |
80 bits | Précision à 10 décimales | ||
Librairies | ANSI | Assertions | assert.h |
|
ctype.h |
Classement de caractères et macros de conversion | |||
Codes d'erreur | errno.h |
Mnémoniques pour codes d'erreur | ||
Arithmétique flottante | float.h |
Macros spécifiques à la plate-forme pour les mathématiques à virgule flottante | ||
Types | limits.h |
Définit les limites spécifiques à la plate-forme pour les valeurs de types | ||
Localisation | locale.h |
Paramètres spécifiques au pays | ||
Mathématiques | math.h |
Prototypes de fonctions mathématiques | ||
setjmp.h |
Définitions de types et fonctions pour setjmp/longjmp | |||
Signaux système | signal.h |
Constantes et déclarations pour signal() et raise() | ||
Arguments | stdarg.h |
Macros pour traiter des listes d'arguments | ||
stddef.h |
Types de données et macros communs | |||
Entrées/Sorties | stdio.h |
Types et macros nécessaires pour E/S standards | ||
Divers | stdlib.h |
Prototypes de fonctions courantes et diverses | ||
Texte | string.h |
Prototypes de fonctions de manipulation de chaînes de caractères | ||
Temps | time.h |
Structures pour routines de conversion de temps |