Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: Question on a C++ string Date: Sun, 29 Dec 2019 13:57:20 -0800 Organization: None to speak of Lines: 25 Message-ID: <871rsmre0v.fsf@nosuchdomain.example.com> References: <87fth3qxbk.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="e3b117bf55650e4ec854fd7e333c3408"; logging-data="29472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+w+PbofMeOAoxN8ZQThf9k" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:UKfNcnXBOhYZMzjgJtIVGPufo4M= sha1:EiFC0sT7uFHD8Msbl7N7qTwhMp8= Xref: csiph.com comp.lang.c++:70788 T writes: > On 2019-12-29 01:45, Keith Thompson wrote: >> Jorgen Grahn writes: >> [...] >>> From a C perspective, a string is a pointer to the first char in a >>> sequence, and the string ends with a char 0 marker. That's probably >>> the one your Windows API wants, if it's a C API like someone wrote. >> >> No, from a C perspective "A string is a contiguous sequence of >> characters terminated by and including the first null character." > > Do I need the chr(0) at the end? I presume that by "chr(0)" you mean the char value '\0', also known as the null character. Your meaning is reasonably clear, but there is no "chr" function in C or C++. Yes, by definition a "string" includes the terminating null character. If there's no null character, it's not a string. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com [Note updated email address] Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */