Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 11658048

@User 11658048
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Exception in code C
    U User 11658048

    in line 54 i have (Liste InsertionOperation(Liste L , Operation op)) Program received signal SIGSEGV

    C / C++ / MFC data-structures debugging help

  • Exception in code C
    U User 11658048

    Hello, This is my code. When i compile and execute it i have the following error:

    1 [main] test 5952 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    722 [main] test 5952 open_stackdumpfile: Dumping stack trace to test.exe.sta
    ckdump

    #include
    #include
    #include

    typedef struct Date{
    int J ;
    int M ;
    int A ;
    } Date;

    typedef struct Operation{
    char Obj[30];
    float Mnt ;
    Date Date_Tr ;
    int Type_Tr ;
    int Etat ;
    } Operation;

    typedef struct Cellule{
    Operation Info ;
    struct Cellule *succ ;
    } Cellule ;

    typedef Cellule * Liste ;

    int EgaliteDates(Date d1 , Date d2)
    {
    if ((d1.J==d2.J) && (d1.M==d2.M) && (d1.A==d2.A))
    return 0;
    else
    {
    if ((d1.A>d2.A) || ((d1.A==d2.A) && (d1.M>d2.M)) || (((d1.A==d2.A) && (d1.M==d2.A) && (d1.J==d2.J))))
    return 1;
    else
    return 2;
    }
    }
    Liste InsertionOperation(Liste L , Operation op)
    {

    	Liste temp;
    	Liste pred;
    	Liste element;
    	element = malloc(sizeof(Liste));
    	element->Info = op;
    	element->succ = NULL;
    
    	if(L == NULL)
    	{
    		L=element;
    	}
    	else
    	{
        	if (EgaliteDates(L->Info.Date\_Tr,op.Date\_Tr)==2)
        	{
        		element->succ= L;
        		L=element;
    		}
    		else
    		{
    		temp=L;
    		pred=L;
        	while((temp->succ != NULL) && (EgaliteDates(temp->Info.Date\_Tr,op.Date\_Tr)<2))
        	{
        		pred=temp;
            	temp = temp->succ;
        	}
        	element->succ=temp->succ;
        	pred->succ = element;
    
        	}
    	}
    	return L;
    

    }

    void afficherListe(Liste L)
    {
    Cellule *tmp = L;
    int i=0;
    while(tmp != NULL)
    {
    i++;
    printf("Objet %d : %s, montant: %f, date : %d %d %d, type: %s\n", i,tmp->Info.Obj,tmp->Info.Mnt,tmp->Info.Date_Tr.J,tmp->Info.Date_Tr.M,tmp->Info.Date_Tr.M,tmp->Info.Type_Tr,tmp->Info.Etat);
    tmp = tmp->succ;
    }
    }

    void RechercheDate(Liste L, Date minDate , Date maxDate )
    {
    Cellule *tmp = L;
    printf("liste des objets entre %d/%d/%d et %d/%d/%d: \n",minDate.J,minDate.M,minDate.A,maxDate.J,maxDate.M,maxDate.A);
    while(tmp != NULL)
    {
    if ((EgaliteDates(tmp->Info.Date_Tr , maxDate)<2) && (EgaliteDates(minDate,tmp->Info.Date_Tr)<2))
    printf("Objet : %s, montant: %f, date : %d %d %d, type: %s\n",tmp->Info.Obj,tmp->Info.Mnt,tmp->Info.Date_Tr.J,tmp->Info.Date_Tr.M,tmp->Info.Date_Tr.M,tmp->Info.Type_Tr,tmp->Info.Etat);
    tmp

    C / C++ / MFC data-structures debugging help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups