M
Michel Rouzic
I had a program that worked perfectly, and that read .wav files. I
changed something so the tags of the wave file, instead of being each
in a different variable, are all in an array, called tag. i also set
macros such as #define bitspersample tag[10] so when in my original
program it was written bitspersample now it acts like its tag[10], and
i also moved things that were in the main function into specific
functions. anyways, the program read the sound data into a multi
dimensionnal array.
now, since i did that change, when i try to access a value from that
multi-dimensional array by doing for example printf("%f",
sound[0][69]); in the main function, it causes a segmentation fault at
this precise line.
i think the multi-dimensionnal array is correctly allocated (the
difference between the old and new program is that the whole allocation
thing is in a function instead of the main function, and that it's
bases on values from that tag array to define its sizes instead of
regular integer variables)
now, i can access to a value of this multidimensional array, inside the
function that fills it, and also in the function that calls that
function and that allocates the array before calling it, but not back
in the main function.
is it a problem due to declaring such a "double **sound" array in the
main function and doing the malloc's in another function?
changed something so the tags of the wave file, instead of being each
in a different variable, are all in an array, called tag. i also set
macros such as #define bitspersample tag[10] so when in my original
program it was written bitspersample now it acts like its tag[10], and
i also moved things that were in the main function into specific
functions. anyways, the program read the sound data into a multi
dimensionnal array.
now, since i did that change, when i try to access a value from that
multi-dimensional array by doing for example printf("%f",
sound[0][69]); in the main function, it causes a segmentation fault at
this precise line.
i think the multi-dimensionnal array is correctly allocated (the
difference between the old and new program is that the whole allocation
thing is in a function instead of the main function, and that it's
bases on values from that tag array to define its sizes instead of
regular integer variables)
now, i can access to a value of this multidimensional array, inside the
function that fills it, and also in the function that calls that
function and that allocates the array before calling it, but not back
in the main function.
is it a problem due to declaring such a "double **sound" array in the
main function and doing the malloc's in another function?