Tableau dans une structure

Résolu
bip98 Messages postés 104 Date d'inscription mercredi 23 avril 2003 Statut Membre Dernière intervention 29 avril 2008 - 23 févr. 2005 à 11:48
bip98 Messages postés 104 Date d'inscription mercredi 23 avril 2003 Statut Membre Dernière intervention 29 avril 2008 - 23 févr. 2005 à 13:14
Je n'arrive pas à créer un tableau dans une structure..

voilà mon code:

public struct struct_motor
{
public string port_dev;
public int v_ind;
public int v_pas;
public bool v_end;
public int[] v_moteur_value = new int[4]; //C'est normal.. on peut pas inisiatliser dans une structure.. alors comment faire ?
}
A voir également:

2 réponses

APWEB Messages postés 74 Date d'inscription lundi 30 juin 2003 Statut Membre Dernière intervention 18 octobre 2006 2
23 févr. 2005 à 12:43
Essaie de le declarer dans ta structure , mais de l'initialiser au moment de l'utiliser ...
public struct struct_motor
{

...
public int[] v_moteur_value ;

}
....
v_moteur_value = new int[4];

AP
3
bip98 Messages postés 104 Date d'inscription mercredi 23 avril 2003 Statut Membre Dernière intervention 29 avril 2008 1
23 févr. 2005 à 13:14
Merci de m'avoir aidé ! ca marche..

Juste une correction:

public struct struct_motor
{
public string port_dev;
public int v_ind;
public int v_pas;
public bool v_end;
public int[] v_moteur_value ;
}

motor_config = new struct_motor();
motor_config.v_moteur_value = new int[4];
1
Rejoignez-nous