What does this line do?

I am currently writing a application c++ application based on a c project.

https://github.com/EddieRingle/portaudio/blob/master/examples/paex_record.c

in which Im a bit confused on what a certain line does, line 216 in the code..


1
2
3
4
5
6
7
8
9
10
11
12
typedef struct
{
    int          frameIndex;  /* Index into sample array. */
    int          maxFrameIndex;
    SAMPLE      *recordedSamples;
}
int main()
{
    paTestData          data;
    data.recordedSamples = (SAMPLE *) malloc( numBytes ); /* From now on, recordedSamples is initialised. */

}


What does the last line the code do?
Last edited on
It allocates an array of numSamples SAMPLEs. The equivalent in semi-idiomatic C++ would be data.recordedSamples = new SAMPLE[numSamples];.
ahh cool.. thanks :)
Registered users can post here. Sign in or register to post.