help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Code Question


From: Vincent Penquerc'h
Subject: RE: Code Question
Date: Fri, 15 Jun 2001 21:17:46 +0100

> I am making a subtle mistake here, but I am not sure exactly what 
> I am doing wrong. I know that If I use new to allocate 
> the 2D array, this works fine. Why does this not work? It 
> compiles fine but segfaults upon execution. Can anyone help 
> me figure out this little puzzle?

double[10][10] is a 2 dim array, but if using new you have an array
of arrays (via pointers). The first version does not have pointers to
the inner dimension, hence mat[0] is *not* a pointer to a double array.
Try replacing double **mat by double *mat[] in the function parameters.

-- 
Lyrian 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]