Salut,
1 2 3 4 5 6 7 8 9 10 11
|
typedef struct{
float x;
float y;
float a;
float b;
float x_result;
float y_result;
float length_result;
} vector;
vector pt_rec; |
.
pt_rec.x etc ... est un float, donc tu peux declarer ta fonction comme suit:
static float DoSth(float x, float a, float y, float b) {
Et l'appel
DoSth(pt_rec.x,pt_rec.a, pt_rec.y, pt_rec.b);
Tu peux aussi faire
1 2 3 4 5
| static float DoSth(vector rec) {
/* tu peux acceder aux aux membres rec.x rec.y etc... */
}
DoSth(pt_rec); |
Ceci dit, les operations de copie de structures sont assez cheres. Moi je ferais avec des pointeurs 
1 2 3 4 5
| static float DoSth(vector *p_rec) {
/* tu peux acceder aux aux membres p_rec->x p_rec->y etc... */
}
DoSth(&pt_rec); |
Partager