? about C arrays
I've been searching the code for the definition of the bond_cashflow array, a class array:
but havn't been able to find a specific array creation statement, ie something like:
but only see this statement:
amt_flow = new bond_cashflow ;
? does the statement above automagically create the "bond_cashflow" array?
thanks very much for any insights!
Well in order for this to be valid C++:
bond_cashflow * amt_cashflow;
amt_cashflow = new bond_cashflow ;
bond_cashflow would need to be a type and the result would be an array called "amt_cashflow".
Now why have you created an array of one element?
Yes that is the way that:
Bond_cashflow * amt_flow;
So by making "amt_flow" a pointer to a "Bond_cashflow" class, it allows one to treat the Bond_cashflow class as if it were a member of an array?
With the mention of class and new, I believe that this question has to do with C++, not C.
Moved to C++ forum.
Well what are you really doing? The appropriate time for new (or malloc in C--I'm still not sure what language you're using) is when you need to allocate a resource, like an array of a certain type. Any other use for new is wrong.
Um ... I think you have that backwards. You're not treating the class as though you it is part of an array, you're making a whole new thing, and that thing turns out to be an array of Bond_cashflows. It doesn't change what a Bond_cashflow is itself.
Originally Posted by bobk544
ok thanks all i'm going to look at this some more and try to create a small protype, appreciate the very considerate help!
If you're just looking for ordinary array-declaration syntax, it looks like this:
In your case, that would be: