CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
C++ Quiz #117

What T Becomes for a String Literal

easyTemplates

Both calls print hi. What is T in the first call, printValue("hi")?

📄 Code

1#include <iostream>
2#include <string>
3 
4template <typename T>
5void printValue(T value) {
6 std::cout << value << "\n";
7}
8 
9int main() {
10 printValue("hi");
11 printValue(std::string("hi"));
12 return 0;
13}