I haven't coded in C for at least a year and am trying to brush up on it with writing a very basic software for calibration. Basically I have a PointCloud
struct
typedef struct {
gsl_vector ** vectors;
gsl_vector * mean;
} PointCloud;
vectors
points to an array of gsl_vectors
and mean
is just a gsl_vector
representing the mean of the vectors in vectors
.
Now suppose I have a variable PointCloud * foo
and assume its internal variables have memory allocated dynamically using malloc()
and are populated. Let bar = foo -> vectors
. How can I get the number of gsl_vectors
in bar
(i.e the number of vectors in the point cloud)? I have tried various combinations such as sizeof(bar)/sizeof(bar[0])
but that gives me the output 1. sizeof(bar)
in itself gives me the value 8. I have tried this on a point cloud with 27 vectors.