In: Computer Science
You will overload a function named printArray. The function will assign values to each element and print out a single dimension array of integers and an array of characters. The main body of the program will call each function. In C++
#include <iostream>
using namespace std;
void printArray(char arr[],int n){
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
void printArray(int arr[],int n){
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
int main()
{ char str[4] = {'C','+','+','\0'};
int a[4] = {1,2,3,4};
printArray(a,4);
cout<<endl;
printArray(str,4);
return 0;
}