4.1 types
consider x=y+f(2); For this to make sense in a c++ program, the names x, y, and f must be suitably declared. That is, the programmer must specify that entities named x, y, and f exit and that they are of types for which =(assignment), +(addition), and()(function call), respectively, are meaningful.
c++程序中出现的名字在使用之前必须被合理的声明,就是说,程序员必须指定实体x, y, f,是存在的,并且这三个实体的类型具有这样的特点,当赋值操作,加操作,函数调用操作作用在这些类型的对象上时,这些操作是有意义的。
Every name(identifier) in a c++ program has a type associated with it. This type determines what operations can be applied to the name(that is, to the entity referred to by the name) and how such operations are interpreted.
float x; // x is a floating-point variable
int y; // y is an integer variable with the initial value 7
float f(int); // f is a function taking an argument of type int and returning a floating-point number
would make the example meaningful.(将能使x=y+f(2);有意义),顺便说一下,我觉得赋值操作符,加操作符,实际上都是函数,针对于自定义类型时,我们重载操作符,不也是把这些操作符来当作函数来处理的么,扩展一上,最好不要把操作符与变量之间加上空格,那样好像是把函数与参数分开了定一样不好。
4.1.1 fundamental types
c++ has a set of fundamental types corresponding to the most
本文探讨了C++中变量和函数的合理声明方式,强调了类型的重要性,它决定了可以应用于标识符的操作及其解释方式。文章还举例说明了如何通过正确的类型声明使表达式具有意义。
6634

被折叠的 条评论
为什么被折叠?



