5 ms·
What's the point of this? It seems like it's the same as not including the asterisk in the first place.
by shaklee3 8y ago
What's the point of this? It seems like it's the same as not including the asterisk in the first place.
- xelxebar 8y agoIt seems this only really matters in function prototype declarations that contain multidimensional arrays. Compare: int foo(char [][*]); int bar(char [][]); The second declaration should give an error. I'm getting this from just reading the spec now, but it looks like the reason has to do with "incomplete" versus "complete" types. Something like 'int arr[]' is an "incomplete type", i.e. an array of ints with unspecified size. While 'int arr[*]' is a complete type for an array with variable length. I'm guessing that array elements must have a complete type, which is why the above snippet gives an error.
- anilakar 8y agoIf I understood correctly, this will be removed in C2x.
- CodeArtisan 8y agoThe size of any upper dimension must be known for the array subscribing operator to work, using * allows you to bypass that in function prototypes.