新的运营商商店将在哪里? [英] Where will new operator store b?

查看:75
本文介绍了新的运营商商店将在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int a = 10;





int b = new int();

b = 20 ;





无论是在堆内存还是堆栈内存中都会存储b以及为什么以及如何存储?

int a=10;


int b=new int();
b=20;


Where will b be stored,whether in heap or stack memory and why and how?

推荐答案

您已经标记了您的问题C ++和.NET,因此以下两个链接之一应该有所帮助:

C++ new [ ^ ]。

C# new [ ^ ]。
You have tagged your question C++ and .NET so one of the following two links should help:
C++ new[^].
C# new[^].


b存储在堆内存中。由于使用new运算符,b分配堆区域。 a存储在堆栈中。

谢谢。
b is stored in heap memory. Since using new operator, b allocates heap area. a is stored in stack.
Thanks.


你可以找到一些关于堆栈和堆内存的非常有用和广泛的信息here [ ^ ]
You can find some very useful and extensive info about stack and heap memory here[^]


这篇关于新的运营商商店将在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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