What is the difference between local and global variables? Explain all types and specify which memory segments they are stored in.