Cours NF01
Cours

Déclaration d'une variable de type tableau

Pour déclarer une variable de type tableau, il est préférable que le type correspondant ait été déclaré auparavant.

const NMAX=100 ;

type Vecteur=array[1..NMAX] of real ;

var v : Vecteur;

La déclaration suivante est autorisée, mais déconseillée :

var v : array[1..100] of integer

L'indiçage peut être un type énuméré :

type Mois=(janvier, fevrier, mars, ..., decembre);

TnbJours=array[mois] of integer;

var T: TnbJours

On peut alors écrire :

T[mars]:=31;

T[fevrier]:=28; ...

Ecriture dans un tableaudéclaration d'un type tableau
AccueilRéalisé avec SCENARI