Computer: Programming Language
single quote in C could mean char array, not just single char   (0)  [vote for, against]

At the moment

"a" --> 'a', '\n' : Valid C

'a' --> 'a' : Valid C

But 'ab` is invalid

'ab' ---> INVALID C

---------

This seems a bit inconvenient if you want to write printable character without a null terminator.

What would be nice is if you are allowed to type this

'subsys_3' ---> {'s','u','b','s','y','s','_','3'}
-- mofosyne, Jun 30 2017

To write a string without a null terminator, just specify the array length; if there's no room for the terminator, it'll be omitted. Dress it up in a macro if you want it to be more maintainable:

char variable[8] = "subsys_3";
-- Wrongfellow, Jun 30 2017


Well, at least it's not in {other} ' general;
-- normzone, Jun 30 2017



random, halfbakery