se sprintf(wh.chunkid,"%s","RIFF"); but this actually writes 5 bytes into wh.chunkid, the 5th character being '\0' the string termination character. So you should use strncpy(wh.chunkid,"RIFF",4). When you write "fmt " (important: this must have the blank space after fmt) to wh.subchunk1id, you could also use strncpy(wh.subchunk1id,"fmt ",4); . The wav file will contain 16-bit audio data (short int), and it will be a stereo audio file at 44100 samples per second. So wh.bitspersample=16; blockalign = etc. etc... 5) Construct a 2-D array of short int variables of dimension sufficient to hold all of the left channel of the stereo audio data, and all of the right-channel of audio data. The number of rows will be the number of audio samples required for the audio length selected by the user. The number of columns will be 2, one for the left channel value and one for the right channel value. Make sure that you correctly calculate how many audio samples are required in the left and right channel vectors. To construct the 2-D array, follow the steps in the book in Chapter 11 and in the lectures. It is a 3-step process. Declare a pntr-pntr-short int. Malloc( ) a 1-D array of pntrshort int’s to hold the memory addresses of the rows of t