h a l f b a k e r yBuy 1/4, get 1/4 free.
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
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'}
[link]
|
|
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"; |
|
|
Well, at least it's not in {other} ' general; |
|
| |