+ 2
Guys , how can i use char* array into a find maximum function using template?
Template with char * array
4 Answers
+ 2
The program that i have to design:
A function template to find max from different data types such as int,char, float, double , long , char*
It says that i have to pass an array as argument by using type template argument and pass the size of the array by using non-type template (i think here integer) arguments
And also to find max in a char* , i need to use function overloading
+ 2
I did it for int, char, float , double , long but char* I'm lost like completely
+ 1
template <class T>
class tryThis{
private:
T* array;
};
you canât template a char* array because itâs set as char. Just use the template variable and it will adapt to what you pass in.
+ 1
Char* is normally a character array. If you have an array of these it will be a matrix