for some reason the following function has return numbers of error such as
1. new types may not be defined in a return type
2. two or more data types in declaration of `initialize'
3. ambiguates old declaration `GrowableArray initialize(GrowableArray&)'

void initialize(GrowableArray &a)
{ unsigned zero=0;
  a.elements=zero;
  a.element=NULL; }

and this is the struct GrowableArray

struct GrowableArray
{ unsigned elements;
  double * element; }

can someone explain to me what is wrong with the function??

also that in the initialize function I had to assign a new value to make a.elements to 0
is there another way around??

Your saying this doesn't work :

struct GrowableArray{
 unsigned size;
 double *array;
}
void initialize(GrowableArray& g){
 g.size = 0;
 g.array = 0;
}

What errors do you get? Post some actual code.

Did you forget your semi-colon after your structure?

Did you forget your semi-colon after your structure?

omg.....you are so right.....
how stupid was that :(
thanks a lot for helping me out :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.