English 中文(简体)
(*)(t (*)[30])中的含义是什么?
原标题:What does the (*) in (int (*)[30]) mean?
  • 时间:2012-04-09 20:02:37
  •  标签:
  • c

<代码>(int (*)[30])在C中的含义是什么? 例如:

int (*b)[30] = (int (*) [30]) malloc(30 * sizeof(int [20]));
最佳回答

这大致是指“指点”。

int (*b)[30]

这意味着“b是30个分类账的点子”。

(int (*) [30])

这意味着“向一个点预测到30个分类账”。

问题回答
int (*b)[30] = (int (*) [30]) malloc(30 * sizeof(int [20]));

细分如下:

      b        -- b
    (*b)       -- is a pointer
    (*b)[30]   -- to a 30-element array
int (*b)[30]   -- of int.

在声明和表述中,如<代码>[>等固定操作者的地位高于非普通操作者,如*,因此,<代码>T *a[]被解释为<代码>T*(a[]; IOW,>为的一系列点。 T。 为指定<代码>a为pointer to an protocol,我们必须强制实施T (*a) [

更广泛地说,<代码>(int (*) [30])系指“在点值上通过<代码>小型<>>/代码>作为30个要素阵列的点值<代码>int。 请注意,从技术上讲,这一表述是多余的,应当删除。

www.un.org/Depts/DGACM/index_french.htm 说自己似乎是错误的。 您重新分配了30个20个系列的<代码>int,但将结果分配给一个30个部分的<代码>int<<<>t;这会造成问题。 假设你重新尝试分配<代码>int的Nx 30矩阵,则以下内容更为安全:

int (*b)[30] = malloc(N * sizeof *b); 

<代码>*b为int [30], sosizeof *b相同。

如何区分C类声明和类型:从外部消失。

  • int (*b)[30].
  • (*b)[30] is an int.
  • (*b) is an int array of length 30.
  • b is a pointer to an int array of length 30.

无名称版本int (*) [30]完全相同,只是删除了名字。

如果您有《方案规划语言》的复印件,则在其中有一个名为<编码>cdecl的方案,可将这些声明翻译成英文。 一段时间以来对《公约》进行了各种修改,例如:_cutils in Debiansupport the nameless form,cdecl.org/a>。

您可使用<条码>cdecl,以图示下列事项:

cdecl> explain (int (*) [30]) 
cast unknown_name into pointer to array 30 of int

页: 1

我们刚刚看到,一个能够提及另一个变量的变量被称为点。 点人据说是“点到”它们所储存的变量。

利用一位协调人,我们可以直接获得它所标明的变量中储存的价值。 为此,我们只得先用星号(*)预先确定点人的身份识别特征,作为参考操作者,可被字面译为“标明的价值”。

关于<代码>(*),实际上没有任何特殊规定。 由于你只是提到某一种类型(而不是一种名称的变数),你只是略去了这个名称。 在这方面,仍然需要教区区分一系列要点,从点到阵列。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签