哪位大佬帮忙解答一下,哭了。

念此生 2019-07-19 12:08:09
char str[ ]="\0";和char str[ ]={'\064';}这两个哪一个是正确定义了字符串?为什么?还有"\\\"表示的是什么意思?谢谢
...全文
253 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
guzl86 2019-07-22
  • 打赏
  • 举报
回复
好难呀,希望我不要用到这个东西,也不要看到这个东西。
636f6c696e 2019-07-22
  • 打赏
  • 举报
回复
字符串必须有截止符\0,单引号定义没有截止符就不是字符串
只会C++啊 2019-07-22
  • 打赏
  • 举报
回复
char str[ ]="\0" 这个定义的字符串。字符串以"\0"结尾。
"\\\"这个应该是转义字符,前面第一个\是表示后面的是输出"\\",这个一般用在地址方面吧
念此生 2019-07-22
  • 打赏
  • 举报
回复
引用 8 楼 636f6c696e的回复:
你自己定义的?我发的里面有这句话?那你别来问了,你自己认为的就是真理,over
[quote=引用 5 楼 念此生 的回复:]
[quote=引用 4 楼 636f6c696e的回复:]双引号单引号分得清吧
[quote=引用 3 楼 念此生 的回复:]
[quote=引用 1 楼 636f6c696e 的回复:]
当然是char str[ ]="\0"
字符串是用一对双引号括起来的字符序列,并用字符型数组来存放

第二个不是字符型数组吗[/quote][/quote]
单引号代表一个字符,所以是字符数组啊呀[/quote][/quote] 感觉你回复的和我的没关系啊
636f6c696e 2019-07-22
  • 打赏
  • 举报
回复
你自己定义的?我发的里面有这句话?那你别来问了,你自己认为的就是真理,over
引用 5 楼 念此生 的回复:
[quote=引用 4 楼 636f6c696e的回复:]双引号单引号分得清吧
[quote=引用 3 楼 念此生 的回复:]
[quote=引用 1 楼 636f6c696e 的回复:]
当然是char str[ ]="\0"
字符串是用一对双引号括起来的字符序列,并用字符型数组来存放

第二个不是字符型数组吗[/quote][/quote]
单引号代表一个字符,所以是字符数组啊呀[/quote]
自信男孩 2019-07-22
  • 打赏
  • 举报
回复
char str[ ]="\0";
这个是定义的字符串,判断依据就是字符串需要有结束标识,就是'\0'
念此生 2019-07-21
  • 打赏
  • 举报
回复
引用 4 楼 636f6c696e的回复:
双引号单引号分得清吧
[quote=引用 3 楼 念此生 的回复:]
[quote=引用 1 楼 636f6c696e 的回复:]
当然是char str[ ]="\0"
字符串是用一对双引号括起来的字符序列,并用字符型数组来存放

第二个不是字符型数组吗[/quote][/quote] 单引号代表一个字符,所以是字符数组啊呀
636f6c696e 2019-07-20
  • 打赏
  • 举报
回复
双引号单引号分得清吧
引用 3 楼 念此生 的回复:
[quote=引用 1 楼 636f6c696e 的回复:]
当然是char str[ ]="\0"
字符串是用一对双引号括起来的字符序列,并用字符型数组来存放

第二个不是字符型数组吗[/quote]
念此生 2019-07-19
  • 打赏
  • 举报
回复
引用 1 楼 636f6c696e 的回复:
当然是char str[ ]="\0" 字符串是用一对双引号括起来的字符序列,并用字符型数组来存放
第二个不是字符型数组吗
赵4老师 2019-07-19
  • 打赏
  • 举报
回复
C++ Character Constants
Character constants are one or more members of the “source character set,” the character set in which a program is written, surrounded by single quotation marks ('). They are used to represent characters in the “execution character set,” the character set on the machine where the program executes.

Microsoft Specific

For Microsoft C++, the source and execution character sets are both ASCII.

END Microsoft Specific

There are three kinds of character constants:

Normal character constants


Multicharacter constants


Wide-character constants
Note Use wide-character constants in place of multicharacter constants to ensure portability.

Character constants are specified as one or more characters enclosed in single quotation marks. For example:

char ch = 'x'; // Specify normal character constant.
int mbch = 'ab'; // Specify system-dependent
// multicharacter constant.
wchar_t wcch = L'ab'; // Specify wide-character constant.

Note that mbch is of type int. If it were declared as type char, the second byte would not be retained. A multicharacter constant has four meaningful characters; specifying more than four generates an error message.

Syntax

character-constant :

'c-char-sequence'
L'c-char-sequence'

c-char-sequence :

c-char
c-char-sequence c-char

c-char :

any member of the source character set except the single quotation mark ('), backslash (\), or newline character
escape-sequence

escape-sequence :

simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence

simple-escape-sequence : one of

\' \" \? \\
\a \b \f \n \r \t \v

octal-escape-sequence :

\octal-digit
\octal-digit octal-digit
\octal-digit octal-digit octal-digit

hexadecimal-escape-sequence :

\xhexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit

Microsoft C++ supports normal, multicharacter, and wide-character constants. Use wide-character constants to specify members of the extended execution character set (for example, to support an international application). Normal character constants have type char, multicharacter constants have type int, and wide-character constants have type wchar_t. (The type wchar_t is defined in the standard include files STDDEF.H, STDLIB.H, and STRING.H. The wide-character functions, however, are prototyped only in STDLIB.H.)

The only difference in specification between normal and wide-character constants is that wide-character constants are preceded by the letter L. For example:

char schar = 'x'; // Normal character constant
wchar_t wchar = L'\x81\x19'; // Wide-character constant

Table 1.2 shows reserved or nongraphic characters that are system dependent or not allowed within character constants. These characters should be represented with escape sequences.

Table 1.2 C++ Reserved or Nongraphic Characters

Character ASCII
Representation ASCII
Value Escape Sequence
Newline NL (LF) 10 or 0x0a \n
Horizontal tab HT 9 \t
Vertical tab VT 11 or 0x0b \v
Backspace BS 8 \b
Carriage return CR 13 or 0x0d \r
Formfeed FF 12 or 0x0c \f
Alert BEL 7 \a
Backslash \ 92 or 0x5c \\
Question mark ? 63 or 0x3f \?
Single quotation mark ' 39 or 0x27 \'
Double quotation mark " 34 or 0x22 \"
Octal number ooo — \ooo
Hexadecimal number hhh — \xhhh
Null character NUL 0 \0


If the character following the backslash does not specify a legal escape sequence, the result is implementation defined. In Microsoft C++, the character following the backslash is taken literally, as though the escape were not present, and a level 1 warning (“unrecognized character escape sequence”) is issued.

Octal escape sequences, specified in the form \ooo, consist of a backslash and one, two, or three octal characters. Hexadecimal escape sequences, specified in the form \xhhh, consist of the characters \x followed by a sequence of hexadecimal digits. Unlike octal escape constants, there is no limit on the number of hexadecimal digits in an escape sequence.

Octal escape sequences are terminated by the first character that is not an octal digit, or when three characters are seen. For example:

wchar_t och = L'\076a'; // Sequence terminates at a
char ch = '\233'; // Sequence terminates after 3 characters

Similarly, hexadecimal escape sequences terminate at the first character that is not a hexadecimal digit. Because hexadecimal digits include the letters a through f (and A through F), make sure the escape sequence terminates at the intended digit.

Because the single quotation mark (') encloses character constants, use the escape sequence \' to represent enclosed single quotation marks. The double quotation mark (") can be represented without an escape sequence. The backslash character (\) is a line-continuation character when placed at the end of a line. If you want a backslash character to appear within a character constant, you must type two backslashes in a row (\\). (SeePhases of Translation in the Preprocessor Reference for more information about line continuation.)
636f6c696e 2019-07-19
  • 打赏
  • 举报
回复
当然是char str[ ]="\0" 字符串是用一对双引号括起来的字符序列,并用字符型数组来存放
内容概要:SSD2828QN4是一款MIPI主桥接芯片,用于连接应用处理器与传统并行LCD接口及支持MIPI从属接口的LCD驱动器。该芯片支持最高每通道1Gbps的串行链路速度,最多可配置4个数据通道,显著减少了信号数量。它支持多种接口模式,包括RGB+SPI组合接口,适用于驱动智能或非智能显示面板,并能通过命令模式和视频模式传输数据。芯片内置时钟和复位模块、外部接口、协议控制单元(PCU)、包处理单元(PPU)、错误校正码/循环冗余校验(ECC/CRC)模块、长包和命令缓冲区、D-PHY控制器、模拟收发器以及内部锁相环(PLL),确保了高效的数据传输和系统稳定性。此外,文档详细描述了芯片的引脚分配、寄存器设置、操作模式、电源序列、时序特性等关键参数,为开发者提供了全面的技术指导。 适合人群:具备一定硬件设计基础,从事嵌入式系统开发、显示技术研究的研发人员。 使用场景及目标:①实现应用处理器与MIPI兼容显示屏之间的高速数据传输;②优化显示系统的功耗表现,减少电磁干扰(EMI);③通过灵活配置不同接口模式来适应各种显示设备的需求。 阅读建议:此文档面向具有一定电子工程背景的专业人士,建议读者结合实际项目需求深入理解各章节内容,特别是关于寄存器配置、时序要求等方面的具体说明。对于初次接触此类技术的开发者而言,建议先熟悉基本概念再逐步掌握高级功能的应用方法。

33,316

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧