Explain the purpose of templating. Additionally, the following code accepts an array and search item as input and return
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Explain the purpose of templating. Additionally, the following code accepts an array and search item as input and return
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; }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!