What are pointers? Pointers are variables that are used to save the position of a value in memory. A memory…