Study of microstructural, optical and electrical properties of Mg dopped SnO thin films