以下两个代码部分如何相同 [英] how the following two code parts same

查看:54
本文介绍了以下两个代码部分如何相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下两个代码部分如何相同:


#include< stdio.h>


void main()

{


char i = NULL;


char& q = i;

^^^^


printf("%d",i);


printf("%d",q);

}


O / p .................. 0 0


#include< stdio.h>


void main()

{


char i = NULL;


char q = i;

^^


printf("% d",i);


printf("%d",q);

}

O / p。 ............... 0 0

how the following two code parts same:

#include <stdio.h>

void main ()
{

char i = NULL;

char &q = i;
^^^^

printf ( "%d", i);

printf ("%d", q);
}

O/p.................. 0 0

#include <stdio.h>

void main ()
{

char i = NULL;

char q = i;
^^

printf ( "%d", i);

printf ("%d", q);
}
O/p ................ 0 0

推荐答案

12月7日下午1:00,saipathak .. 。@ gmail.com写道:
On Dec 7, 1:00 pm, saipathak...@gmail.com wrote:

以下两个代码部分如何相同:


#include< stdio.h> ;


void main()

{


char i = NULL;

char& q = i;

^^^^


printf("%d",i);


printf("%d",q);


}


O / p ... ............... 0 0

#include< stdio.h>


无效main()

{


char i = NULL;


char q = i;

^^


printf("%d",i);


printf("%d",q );


}


O / p ................ 0 0
how the following two code parts same:

#include <stdio.h>

void main ()
{

char i = NULL;

char &q = i;
^^^^

printf ( "%d", i);

printf ("%d", q);

}

O/p.................. 0 0

#include <stdio.h>

void main ()
{

char i = NULL;

char q = i;
^^

printf ( "%d", i);

printf ("%d", q);

}

O/p ................ 0 0



它们是相同的除了行

They are the same except for the lines


char& q = i;
char &q = i;




and


char q = i;
char q = i;



-

Fred

--
Fred


12月8日凌晨2:03 ,fred.l.kleinschm ... @ boeing.com写道:
On Dec 8, 2:03 am, fred.l.kleinschm...@boeing.com wrote:

12月7日下午1:00,saipathak ... @ gmail.com写道:
On Dec 7, 1:00 pm, saipathak...@gmail.com wrote:

以下两个代码部分如何相同:
how the following two code parts same:


#include< stdio。 h取代;
#include <stdio.h>


void main()

{
void main ()
{


char i = NULL;
char i = NULL;


char& q = i;

^^^^
char &q = i;
^^^^


printf("%d",i);
printf ( "%d", i);


printf("%d",q);
printf ("%d", q);


}
}


O / p ...... ............ 0 0
O/p.................. 0 0


#include< stdio.h>
#include <stdio.h>


void main()

{
void main ()
{


char i = NULL;
char i = NULL;


char q = i;

^^
char q = i;
^^


printf("%d",i);
printf ( "%d", i);


printf("%d",q);
printf ("%d", q);


}
}


O / p ...... .......... 0 0
O/p ................ 0 0



它们是相同的除了行


They are the same except for the lines


char& q = i;
char &q = i;




and


char q = i;
char q = i;



-

Fred


--
Fred



i我问两个代码是如何显示的相同的输出。

i am asking how both code is showing same output.


sa ******* ***@gmail.com 写道:

以下两个代码部分如何相同:


# include< stdio.h>


void main()
how the following two code parts same:

#include <stdio.h>

void main ()



Nope。在托管环境中,main()按定义返回int。你的意思是

int main(无效)

这里

Nope. In a hosted environment, main() returns int by definition. You really mean
int main(void)
here


{


char i = NULL;
{

char i = NULL;



您应该看到一个诊断,指示您正在将指针转换为

整数(类型)而不进行强制转换。话虽如此,我现在应该初始化

为零。

You should see a diagnostic indicating that you are converting a pointer to an
integer (type) without a cast. Having said that, i should now be initialized
to zero.


>

char& q = i;
>
char &q = i;



语法错误。你的程序不应该编译。

Syntax error. Your program should not compile.


>

printf("%d",i);

printf("%d",q);

}


O / p .......... ........ 0 0
>
printf ( "%d", i);

printf ("%d", q);
}

O/p.................. 0 0



我不相信你。

I don''t believe you.


>


#include< stdio.h>


void main()
>
#include <stdio.h>

void main ()



再次,

int main(无效)

Again,
int main(void)


{


char i = NULL;
{

char i = NULL;



您应该看到一个诊断,指示您正在将指针转换为

整数(类型)而不进行强制转换。话虽如此,我现在应该初始化

为零。

You should see a diagnostic indicating that you are converting a pointer to an
integer (type) without a cast. Having said that, i should now be initialized
to zero.


char q = i;
char q = i;



q初始化为i的内容。由于我在此声明之前初始化为零并且没有更改
,现在q也应该设置为零。

q is initialized to the contents of i. Since i is initialized to zero and not
changed before this statement, q should now also be set to zero.


>

printf("%d",i);


printf("%d",q);

}


O / p ................ 0 0
>
printf ( "%d", i);

printf ("%d", q);
}
O/p ................ 0 0



OK


那么,你的问题是什么?


-

Lew Pitcher


Master Code Code& JOAT-in-training |已注册的Linux用户#112576
http://pitcher.digitalfreehold.ca/ |可根据要求提供GPG公钥

---------- Slackware - 因为我知道我在做什么。 ------

OK

So, what''s your problem?

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I''m doing. ------


这篇关于以下两个代码部分如何相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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