隐含的类型转换 [英] implicit typecast

查看:66
本文介绍了隐含的类型转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我必须写一个考试,我不确定隐式类型转换。可以

有人请告诉我以下c语句是什么类型的?为什么

他们属于这种类型?这些陈述也可能是错误的。


第一次练习:


int x;

unsigned int ux;

浮动f;

char * p1;

void * p3;

int(* pf) (void);

void(* pf2)(double);

int f1(void);

void f3(double x2);

p1 = p3;

x + = f;

p3 + ux;

pf = f1();

pf2 == f3;

pf2 = f3;

pf = f1;

p3? x:f;

* p3;

第二次练习:


int x;

浮动f;

char * p1;

int f1(int x1);

int f2(int x1,int x2);

int f3(double x1);

int(* pf)(int);

int(* pf2)(double);

p1? f1:pf;

pf = f1;

pf = f1(x);

pf2 = pf;

pf == f1;

pf == pf2;

f = f3(f);

f1 == f2;

++ f;

p1?我:f;


提前致谢!

Greets Pete

解决方案

Peter Drese< pd **** @ yahoo.de>潦草地写道:

你好,
我必须写一个考试,我不确定隐式类型转换。有人可以告诉我以下c语句是什么类型的吗?为什么
他们属于这种类型?这些陈述也可能是错误的。




你不希望我们为你做功课,对吗?这闻起来很可疑。


-

/ - Joona Palaste(pa ***** @ cc .helsinki.fi)-------------芬兰-------- \

\-- http://www.helsinki.fi/~palaste -------------- -------规则! -------- /

在狗的外面,一本书是男人最好的朋友。无论如何,在狗的内心,它太黑了



- Groucho Marx


>你不希望我们为你做功课,对吗?这有点像

一样,有点像它。




如果您愿意,我很抱歉。不幸的是,这不是我的功课。在大约

三周内,我必须在大学写一篇关于这个东西的考试。我尝试了几次b $ b来解决这个问题,但我不确定我的解决方案。

如果你愿意的话,我可以张贴他们但我不会想要影响任何人!


Greets Pete


文章< bt ****** **** @ online.de>,Peter Drese < pd **** @ yahoo.de>

写道:

你好,

我要写一个考试而且我不确定隐式类型转换。有人可以告诉我以下c语句是什么类型的吗?为什么
他们属于这种类型?这些陈述也可能是错误的。




这就像家庭作业一样。任何能够担任教学课程的人都会知道这些问题的答案。

这些。


Hello,

I have to write an exam and I am not sure about implicit typecasting. Can
somebody please tell me of what type the following c-statements are? And why
they are of this type? It is also possible that the statements are wrong.

first exercise:

int x;
unsigned int ux;
float f;
char *p1;
void *p3;
int (*pf)(void);
void (*pf2)(double);
int f1(void);
void f3(double x2);
p1 = p3;
x += f;
p3 + ux;
pf = f1();
pf2 == f3;
pf2 = f3;
pf = f1;
p3 ? x : f;
*p3;
second exercise:

int x;
float f;
char *p1;
int f1(int x1);
int f2(int x1, int x2);
int f3(double x1);
int (*pf)(int);
int (*pf2)(double);
p1 ? f1 : pf;
pf = f1;
pf = f1(x);
pf2 = pf;
pf == f1;
pf == pf2;
f = f3(f);
f1 == f2;
++f;
p1 ? i : f;

Thanks in advance!

Greets Pete

解决方案

Peter Drese <pd****@yahoo.de> scribbled the following:

Hello, I have to write an exam and I am not sure about implicit typecasting. Can
somebody please tell me of what type the following c-statements are? And why
they are of this type? It is also possible that the statements are wrong.



You wouldn''t want us to do your homework for you, would you? This smells
suspiciously like it.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Outside of a dog, a book is a man''s best friend. Inside a dog, it''s too dark
to read anyway."
- Groucho Marx


> You wouldn''t want us to do your homework for you, would you? This smells

suspiciously like it.



I''m sorry if you think so. Unfortunatly it is not my homework. In about
three weeks I have to write an exam at university about this stuff. I tried
to solve the exercise a couple of times but I''m not sure about my solutions.
If you want, I can post them but I don''t want to influence anybody!

Greets Pete


In article <bt**********@online.de>, "Peter Drese" <pd****@yahoo.de>
wrote:

Hello,

I have to write an exam and I am not sure about implicit typecasting. Can
somebody please tell me of what type the following c-statements are? And why
they are of this type? It is also possible that the statements are wrong.



This smells like homework. Anyone who would be in a position teaching
C, and writing exams on the subject should know the answers to all of
these.


这篇关于隐含的类型转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆