识别隐式转换和明确的转换 [英] Identify the implicit cast and explicit cast
问题描述
我想AP preciate它,如果任何人都可以回答我的问题。结果
识别隐式转换和明确的转换?
int类型的= 2,B = 3;浮动F = 2.5;
双D = -1.2;
INT INT_RESULT;
浮REAL_RESULT;
从形式上看,这个问题是没有从视图中的术语一点感觉。还有如隐式转换没有这样的事。术语的投的整点是,它指定一个明确的,要求的转换的。演员是由(类型)
形式的运营商明确要求的类型转换。
在这种情况下,有什么可以显式或隐式调用的转换的。这是可能是对这个问题的作者的意思,而是以C语言术语的知识贫乏搞砸了。
在您的code样品只有一个初始化需要一个转换。并且,当然,转换隐式的,因为没有的投射在你的code任何的
I would appreciate it if anyone can answer my question.
Identify the implicit cast and explicit cast?
int a = 2, b = 3;
float f = 2.5;
double d = -1.2;
int int_result;
float real_result;
Formally, the question makes no sense from the terminological point of view. There's no such thing as "implicit cast". The whole point of the term cast is that it designates an explicitly-requested conversion. Cast is the type conversion explicitly requested by the operator of the (type)
form.
What in this case can be explicit or implicit is called conversion. This is what was probably meant by the author of the question, but screwed up by their poor knowledge of C terminology.
In your code sample only one initialization requires a conversion. And, of course, that conversion is implicit, since there are no casts in your code whatsoever.
这篇关于识别隐式转换和明确的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!