On 8/22/06, Thomas Hruska <[EMAIL PROTECTED]> wrote:
> Michael P. Lang wrote:
> > It's been a long time since I've sat at the computer as a programmer,
> > so pardon me if this is programming 101.
> >
> > What I've got is an array of structs, something like this:
> >
> > [CODE]
> > struct Note
> > {
> > int nPitch;
> > int nDuration;
> > };
> >
> > Note noteMelody[4][10];
> > [/CODE]
> >
> > 1) I have a function that writes random data to each member of each
> > struct in the array. The question is, how do I pass the struct to
> > this function? Do I just need a refresher course on calling by
> > reference?
>
> int MyFunc(Note &TempMelody[4][10])
> {
> }
>
> ...
>
> MyFunc(noteMelody);
>
>
> > 2) Can I adjust the size of the array at runtime?
>
> Yes, but you have to use dynamic memory allocation. Or, the preferred
> method is to use STL (vector< vector<Note> >) (or if you have my book,
> Block or use Block to create a 2DBlock template).
The use of structs would indicate C, not C++, therefore it would
preclude the use of STL or anything using it (or anything like it,)
unless the OP was considering using OOP...
--
PJH
Into motorcycles? Need parts? Try www.gissit.com to contact lots of
motorcycle breakers - free to use (UK based at the moment)
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/