Exemple d’utilisation de structure comme paramètre d’une fonction

Author:


Download

#include 
#include 
struct struct_demo {
  int ID;
  char nom[80];
  char prenom[80];
} ;

void afficher_struct(struct struct_demo parm)
{
  printf("Nom: %s", parm.nom);
}

int main(void)
{
  struct struct_demo arg;

  //Copier une chaîne de caractère dans l'objet 'nom'
  strcpy(arg.nom,"sakoba");

  afficher_struct(arg);

  return 0;
}

Leave a Reply

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