[please Help] erreur de segmentation !!!!!

breton_a -  
 ahmet -
Coucou tt le monde !!

g une erreur de segmentation juste avant le check point 6. Je vois pas du tout a quoi c du !!

Si qqun pouvait m'aider, ca serait ultra giga over mega COOOOOL :D

Voila le fichier increminé :)
[cpp]
#include <stdlib.h>
#include <stdio.h>
#include "tfd.h"
#include <math.h>

int tfd2d(double **x,double **xtre,double **xtim,int Width, int Height)
{

long i,j;
double *x_re=NULL, *x_im=NULL;
int max;

x_re=malloc(max*sizeof(double));
x_im=malloc(max*sizeof(double));

/* if (x_re==NULL || x_im==NULL){
printf("pfffffffffffffffffffffffffffffffffffffffffffffffff\n");
return EXIT_FAILURE;
}*/

printf("check point 1\n");

if (Width>=Height) {
printf("check point 2\n");
max=Width;
printf("check point 3 max = %d\n", max);
}
else {
printf("check point 4\n");
max = Height;
printf("check point 5 max = %d\n", max);
}

printf("check point 6");
max = Height;
printf("max=%d",max);
printf("check point 7");

//transformée des lignes

for(i=0;i<Height;i++){
for(j=0;j<Width;j++){
x_re[j]=x[i][j];
x_im[j]=0;
tfd(x_re,x_im,Width,Height);
}
}

//transformée des colonnes

for(j=0;j<Width;j++){
for(i=0;i<Height;i++){
tfd(x_re,x_im,Height,Width);
}
}

return EXIT_SUCCESS;
}
[/cpp]

1 réponse

ahmet
 
Ca ne serai pas tes malloc : ton max n'as pas encore de valeur, donc tu réserve un espace mémoire de taille aléatoire.
0