I suppose that involves storing your version number in a variable within your program (hard-coded), or in a separate file. Provide a function to get your version number when necessary (such as for upgrading information).
In Windows, I believe that is done through registry. Registry is basically a data file. In DOS days, many programs used .dat files to store information (such as user preferences, etc.). Many of these .dat files were actually just plain text files. However, there were problems of conflicting names. Two programs may have the same name for their data files, such as data.dat. Thus, the registry system was invented and the programs basically let Windows handles much of the data storing that the programs require.
In UNIX, I believe the programs must handle much of the data storing themselves. So you either hard-code it or store it in a separate file (much like .dat file).