有人可以用非常简短的方式详细说明我吗? [英] Can please someone elaborate me this in very brief manner?

查看:143
本文介绍了有人可以用非常简短的方式详细说明我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int * arr = new int [size];



我没有得到这个暗示的东西。



我的尝试:



如果我将值从0更改为10,会有什么不同?我的意思是这样做

大小会影响这个吗?这一切意味着什么?

int *arr=new int[size];

I am not getting what this thing is implying.

What I have tried:

What will be the difference if i change the value from 0 to 10? What i mean is this do
size will affect this? And what it all means ?

推荐答案

引用:

会有什么区别如果我将值从0更改为10?

What will be the difference if i change the value from 0 to 10?



什么值?没有0!



查看代码行,并将其分解:


What value? There is no "0"!

Look at the line of code, and break it down:

int *arr=new int[size];




int                        Integers are involved.
int *                      It's a pointer to an intger
int *arr                   The is called "arr" and it holds a pointer to an integer
int *arr=new               We want a new lump of memory allocated at run time.
int *arr=new int           The new memory will be integer(s)
int *arr=new int[...]      The new memory is an array of integers
int *arr=new int[size]



在运行时分配一个整数数组 - size 的内容表示有多少整数数组将保持,并存储指向 arr中的第一个元素的指针


Allocate at run time an array of integers - the contents of size says how many integers the array will hold, and store a pointer to the first element in arr


这篇关于有人可以用非常简短的方式详细说明我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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