How Should One Print Out a NULL Character without a Space in C
Posted
by sobbayi
on Stack Overflow
See other posts from Stack Overflow
or by sobbayi
Published on 2010-03-17T02:26:35Z
Indexed on
2010/03/17
2:31 UTC
Read the original article
Hit count: 310
I have a situation where I have to print out a NULL character if there is no action in a part of my program. Take for example the code below:
char x = '\0';
...
printf("@%c@\n", x);
I want it to print this:
@@
but it prints out
@ @
Whats the correct way not to have the \0 character printed out a space as above?
© Stack Overflow or respective owner