Templates

A template provides a way to write a function that will work with many different data types. Instead of writing one function to sort integers, another to sort strings, and another to sort double, we can write just one function using a template.

Please study the material at each of the links below.

  1. A Template function to show 3 values
  2. A Template function to sort 3 values
  3. Using swap
  4. Finding a total
  5. A Template bubble sort
  6. A Template bubble sort with function prototype
Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 18 2017 14:08:25.