4 ms·
there's no array type in c
by fatty_patty89 4mo ago
there's no array type in c
- colejohnson66 4mo agoYes it does. It just decays to a pointer at the slightest touch.
- throwaway27448 4mo ago[flagged]
- dwattttt 4mo agoBecause doing a dance to avoid it decaying conveys better information to both the compiler and downstream users of your code.
- throwaway27448 4mo ago[flagged]
- Mikhail_Edoshin 4mo agoThere are differences. E.g. va_xxx functionality may be implemented either with a pointer or an array. The difference becomes visible if you try to pass a va_list to another variadic function and then extract it later with va_arg. About half of compilers will happily do that, and another half will refuse to compile the naive version. (There's a more sophisticated proper way.) https://stackoverflow.com/questions/79897621 https://stackoverflow.com/questions/79897621
- ocreat 4mo agoThere is a big difference between: struct A { int size; char data[]; } struct B { int size; char *data; }