Ok so I should move all of the programs and functions (.m files ) in other drive except drive C (which Matlab has installed), for example drive D. Is It right?
No. You use any drive you want including the one where matlab is installed.
What you mustn't do, and this is not specific to matlab, is store any of your code/documents/pictures/etc. under Program Files or any of its subdirectory. Similarly, don't put your files in the Windows directory.
Typically, Matlab would have created a directory for you to store your files in. You can see what it is by typing
at the matlab prompt. It normally is C:\Users\yourusername\Documents\MATLAB.
As for, I think I can use absolute path for functions so the errors will be fixed
I don't know what Suyraansh Mata really meant, but it is not an option for functions. You cannot call a function by its full path. Even for scripts it's a bit iffy, the only way to invoke them by their full path is to use run.
The proper way to manage the scope of your functions is to put their folder on the matlab path. So you'd put all your files in
mypath = fullfile(userpath, 'SomeMeaningfulFolderName')
to make them all visible to matlab.