C code only compiles once and then closes

1

I have a code that I am writing in C, and then a problem is constantly happening. I do not know if it has anything to do with memory allocation.

I have a function:

struct elementodos interpretar(char* element){

    struct elementodos separado;
    char** pontpont = (char**)malloc(200 * sizeof(char*));

    int i, a, cont, tem[100], cdd, dll, obs,conta,jubs, xevs;
    int mult[100];
    char* brasil = (char*)malloc(100 * sizeof(char));
    char* bahea = (char*)malloc(100 * sizeof(char));
    char** elemfim = (char**)malloc(100 * sizeof(char*));
    char* zoia = (char*)malloc(100 * sizeof(char));

...

for (i=0;i<cont;i++){

        separado.multidor[i]=mult[i];
        separado.cadaum[i]=elemfim[i];

    }
    separado.numero=cont;

return separado;
}

The elements are all defined:

struct elementodos{
    int multidor[100];
    int numero;
    char** cadaum[100];
};

So I call the function in my main:

int main(){
struct elementodos a; 
...

a= interpretar(b);
return 0;

The problem is that this runs perfectly the first time, however, on the second it gives crash at the command prompt.

Ps: Does not return any errors.

When I run debugger, the only thing that appears is:

In _Jv_RegisterClasses () ()
In _Jv_RegisterClasses () ()
[Inferior 1 (process 4184) exited normally]
Debugger finished with status 0
    
asked by anonymous 13.12.2017 / 17:45

0 answers