Explain the purpose of templating. Additionally, the following code accepts an array and search item as input and return
Posted: Mon May 09, 2022 5:52 am
Explain the purpose of templating. Additionally, the following code accepts an array and search item as input and returns whether that item is not an element of the array. Revise this functions definition so it uses templating to support multiple data types. bool not_exists(int arr[], int size, int item) { for (int i = 0; i < size; i++) { if (arr == item) return false; } return true; }