Non null-terminated string compiler option for gcc

前端 未结 5 1830
慢半拍i
慢半拍i 2020-12-11 04:01

Update

turns out this is just another case of \"c++ is not c blues\"


What I want

const char hex[16] = \"0123456789ABCDEF\";
         


        
5条回答
  •  遥遥无期
    2020-12-11 04:57

    No. NUL-terminated strings are intrinsic to the language. You can have a character array though, and set each character one by one:

    char hex [] = {'0', '1', '2', ... 'F'};
    

提交回复
热议问题