如果我们仅使用“ signed”和“ unsigned”而没有任何原始数据类型,将会发生什么?

时间:2018-07-06 18:46:00

标签: c++

如果我们不将int或char放在无符号和有符号变量之后会怎样?

#include<iostream>
using namespace std;
int main()
{
    unsigned u = 10; // how is this declaration helpful?
    signed s = 12;   // is there any use with such declarations without specifying a primitive datatype 
    cout << u << "  " << s << endl;  // prints the values of the variables as usual
    return 0; 
}

1 个答案:

答案 0 :(得分:3)

signedunsigned分别隐含表示signed intunsiged int