A voir également:
- Tableau des listes chainées
- Tableau word - Guide
- Tableau ascii - Guide
- Trier un tableau excel - Guide
- Imprimer un tableau excel - Guide
- Dans le fichier, générez ce tableau automatiquement (tableau croisé dynamique ou table de pilote) à partir des quatre premières colonnes. - Guide
2 réponses
ce sont les structures que je vais utiliser:
typedef struct vil
{
char Nom_ville [20] ;
int Code_postal ;
}vill;
typedef struct element
{
vill ville;
struct element *p ;
}node;
typedef struct list
{
node *head;
node *courant;
}liste;
et c'est la fonction d'initialisation:
#include <stdio.h>
#include <stdlib.h>
#include "struct.h"
#define N 24
void initialiser_table(liste T[])
{
int j;
printf("fct initialiser\n");
for(j=0;j<N;j++)
{
T[j]=malloc(sizeof(liste));
printf("main1\n");
T[j]->head=NULL;
T[j]->courant=NULL;
printf("fin fct");
return ;
}
typedef struct vil
{
char Nom_ville [20] ;
int Code_postal ;
}vill;
typedef struct element
{
vill ville;
struct element *p ;
}node;
typedef struct list
{
node *head;
node *courant;
}liste;
et c'est la fonction d'initialisation:
#include <stdio.h>
#include <stdlib.h>
#include "struct.h"
#define N 24
void initialiser_table(liste T[])
{
int j;
printf("fct initialiser\n");
for(j=0;j<N;j++)
{
T[j]=malloc(sizeof(liste));
printf("main1\n");
T[j]->head=NULL;
T[j]->courant=NULL;
printf("fin fct");
return ;
}