Infosys Interview Question

Tell me about Diode , Write a C program (moderate level of difficulty)