问题描述
他们会在不同的C和C ++的工作?
P.S。我的第一个问题,我是一个编程小白所以请尽量保持asnwer基本和简单的:)
感谢你在前进!
-
为int * A [5] -
这意味着,a是一个指针数组,即阵列中的每个部件a是一个指针搜索
整数类型;数组的每个成员都可以容纳一个整数的地址。 -
INT(*一)[5] -
这里a是一个指针5的整数的数组,换言之
一指向包含5整数数组。
例如:
#包括LT&;&stdio.h中GT;
诠释的main()
{
INT B = 3;
INT C = 4;
为int * a [2] = {和B,和C}; //是一样的---为int * a [] = {和B,和C}
的printf(价值指向一个[0] =%d个,由[1] =%d个\\ N,* A [0],*一[1]);
返回0;
}
Would they work differently on C and C++?
P.s. My first question and I am a programming noob so please try to keep the asnwer basic and simple :)
Thank you in advance !
int *a[5] -
It means that "a" is an array of pointers i.e. each member in the array "a" is a pointer
of type integer; Each member of the array can hold the address of an integer.int (*a)[5] -
Here "a" is a pointer to the array of 5 integers, in other words"a" points to an array that holds 5 integers.
Example :
#include<stdio.h>
int main()
{
int b = 3;
int c = 4;
int *a[2] = {&b, &c}; // is same as ---int *a[] = {&b, &c}
printf("value pointed to by a[0] = %d, by a[1] = %d\n", *a[0], *a[1]);
return 0;
}
这篇关于什么是之间和QUOT的差异;为int * A [5] QUOT;和INT(*一)[5]&QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!