Advertisement
Eiffel

CIS 22B Worksheet Template #1

Feb 26th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. void displayArray(T s[], int r) {
  6.     for (int i = 0; i < r; i++)
  7.         cout << s[i] << " ";
  8.     cout << endl;
  9. }
  10.  
  11. int main() {
  12.     int arr[] = { 1,2,3,4 };
  13.     const int SIZE = 4;
  14.  
  15.     displayArray(arr, SIZE);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement