I have a question for using of key word auto when I run code below:
auto i_num = {1};
printf("%x", i_num);//61fecc
return 0;
I think it's the same as below but not:
int i_num = {1};
printf("%x", i_num);//1
return 0;
Can anyone explain this difference to me? It seems auto i_num and int i_num define different things.
61fecc
≠1
.std::initializer_list<int>
≠int
.auto i_num{1};
auto i{1};
was changed to be an int, butauto i = {1};
is still an initializer_list. A "good" compromise...