开发者

Dynamic variables and

开发者 https://www.devze.com 2023-03-28 06:32 出处:网络
Would it be a good idea for me to learn something what dynamic variables actually mean and how they help to make my windows Vista ?

Would it be a good idea for me to learn something what dynamic variables actually mean and how they help to make my windows Vista ?

I have heard that

int* g=new int[50];

is supposed to dynamically allocate memory for an array of 5开发者_开发问答0 integers. And g is called a dynamic variable too. If so, what are dynamic variables in my windows ? I think this is more of a concept than of some computable objects to define. And I am in the middle of nowhere between both.


You should definitely read a good book, but I'll give you some brief answers here anyway.

Would it be a good idea for me to learn something what dynamic variables actually mean?

Yes.

I have heard that

int* g=new int[50];

is supposed to dynamically allocate memory for an array of 50 integers.

That's right.

And g is called a dynamic variable too.

There may be people who use this terminology, but I haven't heard it and I wouldn't adopt it.

g itself is not dynamic at all. It's a pointer, with automatic storage duration ("on the stack" in colloquial language). It has no particularly magic properties.

The "dynamic object" here is the array of fifty integers. This object has no name, and you can only access it through the pointer g (or through another pointer with the same value as g).

If so, what are dynamic variables in my windows ? I think this is more of a concept than of some computable objects to define. And I am in the middle of nowhere between both.

And I don't understand this part of the question at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号