[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What is the preferred way to embed multi-line string in C source?
- From: "Eric Tetz" <erictetz@...>
- Date: Sat, 20 Dec 2008 14:24:30 -0800
pan shizhu <pan.shizhu@gmail.com> wrote:
> xxd -i output a char array like the following, which is not a string
> literal.
>
> unsigned char ltools_lua[] = {
> 0x0a, 0x6c, 0x6f, 0x63, 0x61,
> };
That's similar to what Dave was pointing out earlier:
const char* s = "foo...bar"; /* string literal; limited to 4096 */
const char s[] = "foo...bar"; /* initializer, NOT a string literal */
The latter is equivalent to:
const char s[] = { 'f', 'o', 'o', ... 'b', 'a', 'r' };