Home  >  Article  >  Can the group name be considered a pointer variable?

Can the group name be considered a pointer variable?

烟雨青岚
烟雨青岚Original
2020-07-14 14:35:322811browse

The group name cannot be regarded as a pointer variable. The array name is an address, which is equivalent to a pointer in a sense, not a pointer variable; a pointer variable can not only point to the first address of an array, but can also point to others, for example: the first address of a structure, the entry address of a function.

Can the group name be considered a pointer variable?

The group name cannot be regarded as a pointer variable.

Pointer variables can not only point to the first address of an array, but also point to others.

For example, the first address of the structure, the entry address of the function, etc. Or it can point to an element in the array.

The array name is an address, which is equivalent to a pointer in a sense. rather than a pointer variable.

Pointer variable

int *p=0;

p is a pointer variable.

Pointer variables can be array names. Array names are pointers. The range of pointer variables is large

Define a

int *p=0;
p=(int *)malloc(n*sizeof(int));    //这里用到的是你们将学到的动态分配内存

You can define a dynamically sized "array";

You can then assign a value.

For example

for(i=0;i<n;i++)
p[i]=i
;

Here P is an array name

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of Can the group name be considered a pointer variable?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn