When preparing for a procedure that involves a general anesthetic, advice will be given by the doctor on how long before the procedure to refrain from eating and drinking. 
Read more about surgery preparation and aftercare here - 
https://www.drcarolyndean.net/surgery-preparation-and-aftercare-to-promote-wellbeing/