3 ms·
> Conflating pointers with arrays. AND Strings. FTFY.
by tus88 6y ago
> Conflating pointers with arrays.
AND Strings.
FTFY.
- yarrel 6y agoC doesn't have strings. ;-)
- Snarwin 6y agoMore precisely, it doesn't have a string type.
- Skunkleton 6y agoIt certainly has string literals, which are a kind of type.
- mark-r 6y agoThat's the thing, they're not a type - they're just an array of char with an unspecified length, indistinguishable from any other array of char or pointer to char. Only the convention of ending them with a null character makes them usable at all.
- Skunkleton 6y agoprintf("%lu\n", sizeof("Well, actshully")); -> 16
- rightbyte 6y agoOne could say that C has a different type for each string size plus the joker pointer to char.
- tus88 6y agoThat's because they were conflated with both arrays and pointers.