-
-
Save fabiogaluppo/9223837880fbe0c777c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//type declaration | |
int x = 2; | |
double e = 2.71828; | |
std::string s = "Simply C++"; | |
std::cout << x << " -> "<< typeid(x).name() << "\n"; //2 -> int | |
std::cout << e << " -> "<< typeid(e).name() << "\n"; //2.71828 -> double | |
std::cout << s << " -> "<< typeid(s).name() << "\n"; //Simply C++ -> class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > | |
//type deduction | |
auto x_ = x; | |
auto e_ = e; | |
auto s_ = s; | |
std::cout << x_ << " -> "<< typeid(x_).name() << "\n"; //2 -> int | |
std::cout << e_ << " -> "<< typeid(e_).name() << "\n"; //2.71828 -> double | |
std::cout << s_ << " -> "<< typeid(s_).name() << "\n"; //Simply C++ -> class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment