Initialisation of variables

why it was not showing the error when variables are not initialised and placed inside the main function but it was showing the error when they placed outside the main or in some other function