The files do have a rigid format structure. If this structure is not adhered to, files may not play or open for editing by some applications.
To the original question: wave files can be divided into two groups. The first group consists of files with more than 2 channels of audio OR with a PCM bit depth greater than 16 or both. The second group is comprised of files which do not meet both of those conditions, i.e. 1 or 2 channels with up to 16 bits. Over the years, Microsoft has kludged the structures contained in wav files to accomodate advances in computer audio technology. Specifically, they added a 2-byte field called cbSize to the WAVEFORMATEX structure. This is why you see subchunk1size values of both 16 and 18. The two-byte difference depends on the presence or absence of the cbSize field. Properly-formed modern-day audio files using the current version of WAVEFORMATEX will have a subchunk1size of 18 regardless of channel count or bit depth. Old files created before Microsoft changed the WAVEFORMATEX structure have a subchunk1size of 16.
Here is my policy:
When reading a file, subchunk1size can be either 16 or 18, so the code should adapt accordingly. There are plenty of old wav files with the old format out there, or a modern file could be incorrectly written with the old WAVEFORMATEX structure without the cbSize field.
When creating a wav file, I always use a subchunk1size of 18 regardless of channel count or bit depth because Microsoft has permanently changed the WAVEFORMATEX structure and that makes the file conformant with spec.
Windows Media Player is useful for making sure your wav file can be opened and played.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd390970%28v=vs.85%29.aspx