structures qui s'appellent réciproquement
Bonjour, j'ai fait 2 structures qui s'auto-appellent : voici mon species.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#ifndef _SPECIES_H_
#define _SPECIES_H_
#include "mechanism.h"
typedef struct {
char * name; /* name */
double M; /* molar mass */
double T; /* critical temperature */
double * LT; /* 7 low temperature coefficients */
double * HT; /* 7 high temperature coefficients */
} Species;
Species * CreateEmptySpecies(void);
Species * CreateSpecies(char *,double,double,double *,double *);
Species * CopySpecies(Species *);
void PrintSpecies(Species *);
void DestroySpecies(Species **);
unsigned short NumberSpecies(char *,Mechanism *); // ici il y a un Mechanism
void LoadSpecies(char [],char *,Species *);
#endif |
Et voici mon mechanism.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#ifndef _MECHANISM_H_
#define _MECHANISM_H_
#include "vector.h"
#include "matrix.h"
#include "species.h"
typedef struct{
unsigned short ns; /* numbers of species */
unsigned short nr; /* numbers of reactions */
Species ** species; /* array of species */
il y a d'autres champs comme des matrices et des tableaux
} Mechanism;
Donc Species et Mechanism s'appellent réciproquement. Comment faire ? J'ai une solution : ma fonction NumberSpaces(char *, Mechanism *) peut etre transformée en NumberSpaces(char *,Matrix * m1,Matrix * m2) et ainsi le tour est joué, mais j'aimerais garder le prototype NumberSpaces(char *, Mechanism *)
Avez-vous une idée ?
Merci. |