/*
* personne.h
*
*/
#include<stdio.h>
#include <stdlib.h>


//declaration de la structure contact
typedef struct Contact {
    int identifiant;
    char nom[20];
    char prenom[20];
    int tel[10];
    struct Contact *suivant;
}Contact;


typedef Contact *LSCcontact;

//fonction de calcul de la longueur de la liste
int longueur(LSCcontact lst);

//fonction permet d’ajouter un enregistrement dans la liste chainee
void AjouterPos(LSCcontact *c, int pos);
void AjouterPosition(LSCcontact *c, LSCcontact element, int pos);
void Ajouter(LSCcontact list, LSCcontact element); //ajout dans une liste triee

//fonction de recherche en fonction de l’identifiant
LSCcontact Rechercher(LSCcontact lst, int idf);

//fonction de suppression en fonction de l’identifiant
void Supprimer(LSCcontact *list, int idf);

//fonction d’affichage
/*void Afficher(LSCcontact);
.....*/

void Afficher(LSCcontact liste)
{
    LSCcontact element = liste;
    if (element == NULL) printf("Liste Vide \n");
    else
    while(element != NULL)
    {
        printf("L’identifiant : %d, \n", element->identifiant);
        element = element->suivant;
    }
}
/* Nom : %s, Prenom %s, telephone %d */

LSCcontact creationcellule ()
{ // Créer une boite
    LSCcontact boite = NULL;
    boite = (LSCcontact)malloc(sizeof(Contact));
    printf("Saisir identifiant \n");
    scanf("/%d", &boite->identifiant);
    boite->suivant = NULL;
    return boite;
}

void construireListe (LSCcontact *lst, int nb)
{
    int cpt=0;
    LSCcontact p, t, tmp;
    while (cpt < nb)
    {
        p = creationcellule();
        p->suivant = tmp->suivant; //*NULL
        tmp->suivant = p;
        cpt++;
    }
}
