0

Why, when setting up the buffer below, do you not need to use malloc to set aside memory for it? My code works fine, I just want to understand this a little better. Thanks, in advance, for the help.

int16_t buffer;
    
    while (fread(&buffer, sizeof(int16_t), 1, input))
    {
        buffer = buffer * factor;
        fwrite(&buffer, sizeof(int16_t), 1, output);
    }
0

You are declaring int16_t buffer;. That allocates space on the stack for one 16 bit integer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .