Thank you, everyone.
Originally Posted by
grumpy
Wrong. It is implementation defined whether the char type is signed or unsigned.
Hi Grumpy
But int is always system dependent but it's not true of char. Okay. Could you please what does implementation mean in this context? Is it how a certain compiler deals with it? Please tell me. Thanks.
Originally Posted by
C_ntua
Try the code in your very first post giving a value of 100 to a from the console.
Post the results.
Hi C_ntua
Okay. Here are the results for the codes in my first post.
Code:
#include <iostream>
using namespace std;
int main()
{
unsigned char a = 100;
unsigned char b = a + 59;
cout << "enter a = ";
cin >> a;
cout << b << endl;
system("pause");
}
Output from the Command Prompt:
Code:
enter a = 100
ƒ
Press any key to continue . . .
Code:
#include <iostream>
using namespace std;
int main()
{
char a = 100;
char b = a + 59;
cout << "enter a = ";
cin >> a;
cout << b << endl;
system("pause");
}
Output from the Command Prompt:
Code:
enter a = 100
ƒ
Press any key to continue . . .