i'm newby to C++.
Small code as follows:
int main(int argc, char* argv[]) {
cout << "function main() .." << '\n';
char ch1;
int int1;
cin >> ch1;
cin >> int1;
cout << ch1 << '\n';
cout << int1 << '\n';
return 0;
}
when i run the program and input the following:
function main() ..
az
i get :
a
32767
i understand the 'a' but why the integer value of 32767?
I just want to test and see what happen if instead of a numeric value assigned to int1 i used a 'z'.
i try :
ax
and i also get same results.
ps: by the way the sizeof(int) = 4 on my machine. 64 bit chip.
Now if instead of int i use short and running the program.
function main() ..
az
i get:
a
0