I compiled c program with this code
printf("|%5c|", '\0'); width 5 is just for example
then used cat -e on a.out
./a.out | cat -e
and have this on the output
| ^@|$
Am i right that it is '\0' represented as ^@? What is it and how does it work?
I compiled c program with this code
printf("|%5c|", '\0'); width 5 is just for example
then used cat -e on a.out
./a.out | cat -e
and have this on the output
| ^@|$
Am i right that it is '\0' represented as ^@? 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). 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.