Endoscopy is pivotal in the diagnosis of cancer. It allows for the direct visualization of suspicious areas, which can be biopsied and assessed for the presence of cancerous cells. Common types of endoscopy used in cancer diagnosis include colonoscopy for colon cancer, gastroscopy for stomach cancer, and bronchoscopy for lung cancer.