从stack / bss分配的变量?? [英] variable allocated from stack/bss ??

查看:60
本文介绍了从stack / bss分配的变量??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于以下代码&变量i。


int main(int argc,char ** argv){

int i;

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

返回0;

}


这里我从bss或堆栈分配?


我认为它是堆栈,因为它打印垃圾值;如果从bss分配

,默认值为0

请告诉我,如果我是对还是错?

Given the following code & variable i .

int main(int argc,char **argv){
int i;
printf("%d\n",i);
return 0;
}

here i is allocated from bss or stack ?

I think it is stack,because it prints garbage value; If it were
allocated from bss the default value would be 0
please tell me if I am right or wrong ??

推荐答案



onkar写道:

onkar wrote:

给出以下代码&变量i。


int main(int argc,char ** argv){

int i;

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

返回0;

}


这里我从bss或堆栈分配?


我认为它是堆栈,因为它打印垃圾值;如果从bss分配

,则默认值为0

请告诉我,如果我是对还是错?
Given the following code & variable i .

int main(int argc,char **argv){
int i;
printf("%d\n",i);
return 0;
}

here i is allocated from bss or stack ?

I think it is stack,because it prints garbage value; If it were
allocated from bss the default value would be 0
please tell me if I am right or wrong ??



局部变量存储在堆栈中。 BSS用于未初始化的全局或静态变量。

Local variables are stored on the stack. BSS is used for uninitialized
global or static variables.


MQ说:


< snip>
MQ said:

<snip>

本地变量存储在堆栈中。
Local variables are stored on the stack.



C& V please。

C&V please.


BSS用于未初始化

全局或静态变量。
BSS is used for uninitialized
global or static variables.



C& V please。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。

C&V please.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


onkar说:
onkar said:

给出以下代码&变量i。


int main(int argc,char ** argv){

int i;

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

返回0;

}


这里我从bss或堆栈分配?
Given the following code & variable i .

int main(int argc,char **argv){
int i;
printf("%d\n",i);
return 0;
}

here i is allocated from bss or stack ?



C标准并不要求你的实现有bss或堆栈。

然而,它确实要求你为printf提供一个合适的原型,

它还要求你不要评估不确定价值的

物品。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。

The C Standard doesn''t require your implementation to have a bss or a stack.
It does require, however, that you provide a proper prototype for printf,
and it also requires that you don''t evaluate indeterminately-valued
objects.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


这篇关于从stack / bss分配的变量??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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