Is it possible to save a char '\0'inside a char array and then store different characters after? for instance
'\0'
char* tmp = "My\0name\0is\0\0";
I was taught that it is actually called a string list in C, but when I tried to print above (using printf("%s\n", tmp)), it printed only
printf("%s\n", tmp)
"My".
Yes, of course, it is possible, however, in addition, you cannot use this array as a string and get the contents stored after '\0'.
char, , '\0'. (, , '\0' , %s printf()).
char
%s
printf()
C11, §7.1.1,
C11
, . [...]
, , .
, tmp. , printf, , , , \0
tmp
, tmp
int main(int c,char** a){ char* tmp = "My\0name\0is\0\0"; write(1,tmp,12); }
Source: https://habr.com/ru/post/1666161/More articles:Ansible: shell script вывод всегда пустой - shellhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1666157/how-to-use-both-howlerjs-and-wavesurferjs-together&usg=ALkJrhhoApYmujQ23LTBvm1J6Q-bOMhjGgHow to compare multiple fields in Elm? - comparisonBase SQL SUM and JOIN - sqlExiting a for loop that creates divs when it reaches the end of the screen - javascriptHow to present and then load a custom dataset with different number of columns for some records in sci-kit learn - pythonInstagram business interface information - instagram-apiCompatibility C89 / C90, C99 and C11 - cMap JSON pointer to a row {row, column} in a JSON text file - jsonConfiguring the receiver when calling webRTC - javascriptAll Articles