logoalt Hacker News

dnauticsyesterday at 10:20 PM4 repliesview on HN

What is **int[3][5]


Replies

kazinatortoday at 2:48 AM

In C declaration syntax, there is a "stem" called declaration specifiers consisting of specifiers and qualifiers. That's where int can appear. After that, there is a declarator. In some cases, multiple declarators separated by a comma, which share the same "stem".

  int a, b, *c; // one stem consisting of "int", three declarators.
The * is declarator syntax for deriving a pointer type. It never appears such that a type specifier would come after it somewhere to the right.

Some languages have extended the C declaration syntax such that the type derivators can be moved from the declarator part to the "stem". For instance, as an alternative to:

  int a[10];
you can write

  int[10] a;
This is how we could get

   **int[3]
as a declarator stem indicating an array of 3 pointers to pointers to int. But it's not in C.
arcfourtoday at 11:38 AM

The work of the mythical four star programmer? https://wiki.c2.com/?ThreeStarProgrammer

ori_byesterday at 10:51 PM

A syntax error. You need a variable name, not a type name, in the middle.

show 2 replies
thranceyesterday at 11:46 PM

A pointer to a pointer to a pointer to a pointer of integers.