简体   繁体   English

这些标志是什么意思? ^@

[英]What do these signs mean? ^@

I compiled c program with this code我用这段代码编译了 c 程序

printf("|%5c|", '\0'); width 5 is just for example宽度 5 只是例如

then used cat -e on a.out然后在 a.out 上使用 cat -e

./a.out | cat -e

and have this on the output并在 output 上有这个

| ^@|$

Am i right that it is '\0' represented as ^@? '\0' 表示为 ^@ 对吗? What is it and how does it work?它是什么以及它是如何工作的?

The ^ (control) symbol represents subtraction of 64 from an ASCII value (or maybe more accurately, clearing of the sixth and seventh bits, but it's the same thing for values between 64 and 95). ^ (控制)符号表示从 ASCII 值中减去 64(或者更准确地说,清除第六位和第七位,但对于 64 到 95 之间的值也是一样的)。 For example, "A" is 65, and ^A is 1. M is 77, and ^M is 13. "@" is 64, so ^@ is a way of writing character 0.比如“A”是65,^A是1。M是77,^M是13。“@”是64,所以^@是字符0的写法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM