C的新手 [英] newbie in C

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

问题描述



嗨组,

假设您执行以下操作


int x;

int * ptr;

prt =& x;


没有赋值给x


但是你在虚拟机上运行的编译器中执行此操作,

这样做会损坏物理机吗?


提前感谢Carlos。

解决方案

>让我们假设您执行以下


>
int x;
int * ptr;

prt =& x;

没有赋值给x

但是你在虚拟机上运行的编译器中完成所有这些操作,这样做会损坏物理机吗?



否。它也不能损坏虚拟机 - 或者进程

代码运行。


这是一个技巧问题吗?


Dave


sd写道:


嗨组,

假设你这么做以下


int x;

int * ptr;

prt =& x;

没有为x
分配任何价值

到目前为止一切都很好,一旦你修复了拼写错误的标识符(即

编译器会告诉你prt没有定义,因为你有一个变量

名为ptr而不是prt)。


如果你这样做:


printf("%d \ n",* ptr);


你会得到一个随机值(虽然不是加密随机,但它可能非常容易预测,但不是C ++标准),但你根本不会伤害计算机。


>

但是你在虚拟机上运行的编译器中都这样做了吗?

这样做会损坏物理机吗?


提前感谢,Carlos 。





借口,我正在学习这些疯狂的东西


int * ptr;

ptr = 65;


现在这个错误看起来不错

这种方式ptr没有指向

到任何变量


当然,我在虚拟机内执行此操作。

这样做会损坏物理空间

机器。


非常感谢,Carlos。



" sd" < is *** @ mail.comescreveu na mensagem

news:%2 **************** @ TK2MSFTNGP04.phx.gbl ...


>

嗨组,

假设你做以下事情


int x;

int * ptr;

prt =& x;


未指定任何值x


但你在虚拟机上运行的编译器中完成这一切,

这样做会损坏物理机吗?

提前感谢,卡洛斯。




Hi group,
lets suppose you do the following

int x;
int * ptr;
prt = &x;

without assigning any value to x

but you do this all within a compiler running on a virtual machine,
do this can damage the physical machine ?

thanks in advance, Carlos.

解决方案

>lets suppose you do the following

>
int x;
int * ptr;
prt = &x;

without assigning any value to x

but you do this all within a compiler running on a virtual machine,
do this can damage the physical machine ?

No. And neither can it "damage" the virtual machine - or the process
the code runs in.

Is this a trick question?

Dave


sd wrote:

Hi group,
lets suppose you do the following

int x;
int * ptr;
prt = &x;

without assigning any value to x

So far everything is just fine, once you fix the misspelled identifier (i.e.
compiler will tell you that prt is not defined, because you have a variable
named ptr but not prt).

If you were to do:

printf("%d\n", *ptr);

you would get a random value (not crypto random though, it may be very
easily predictable, but not by the C++ standard), but still you won''t harm
the computer at all.

>
but you do this all within a compiler running on a virtual machine,
do this can damage the physical machine ?

thanks in advance, Carlos.




excuseme, i m learning this crazy things

int * ptr;
ptr = 65;

now this mistake looks ok
this way ptr doesnt point
to any variable

of course, I do this inside a VM.
do this can damage the physical
machine ?.

thanks very much, Carlos.



"sd" <is***@mail.comescreveu na mensagem
news:%2****************@TK2MSFTNGP04.phx.gbl...

>
Hi group,
lets suppose you do the following

int x;
int * ptr;
prt = &x;

without assigning any value to x

but you do this all within a compiler running on a virtual machine,
do this can damage the physical machine ?

thanks in advance, Carlos.



这篇关于C的新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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