C/C++: Initialisation d’un membre spécifique d’une structure

Author:


Download

#include 

struct demo_struct
 {
  int ID;
  char nom[80];
  char prenom[80];
  long note;

} etudiant;

int main(void)
{
	/*
	 Initialiser les Membres 'nom' et 'Note'.
	 Note: Uniquement en C99
	*/
	demo_struct initMembre={
	 .nom="Sakoba",
	 .Note=16
	};

 printf("Nom= %s, Note: %dn", initMembre.nom, initMembre.Note);

 return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *