Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5928155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:15:36+00:00 2026-05-22T14:15:36+00:00

When I printf a char with %c format and the char is unprintable like

  • 0

When I printf a char with %c format and the char is unprintable like ‘\0’ then there is no column of printout. Same if I use %1c. Or %1.1c. Is there a way to force printf to output a column for ‘\0’?

I’m doing some large printf’s and I want columns to match up.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:15:37+00:00Added an answer on May 22, 2026 at 2:15 pm

    There is nothing you can do for printf. But you can use isprint to filter the arguments of printf

    printf("%c", (isprint(c) ? c : ' ' ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

char label[8] = abcdefgh; char arr[7] = abcdefg; printf(%s\n,label); printf(%s,arr); ====output========== abcdefgh abcdefgÅ Why
void TestPrint(char* format, ...) { va_list argList; va_start(argList, format); printf(format, argList); va_end(argList); } int
Possible Duplicate: Is there a printf converter to print in binary format? Still learning
Let's say I want to do something like this void my_printf(char *fmt,...) { char
char *a = apple; printf(%s\n, a); // fine printf(%s\n, a[1]); // compiler complains an
{ char *a, *b; printf(%lx\n,(b-a)); } Usually works, in fact, I can't imagine it
main() { char a,b,c; a=6; b=-5; c = a+b ; printf (%d %d %d
while(1){ //Command prompt char *command; printf(%s>,current_working_directory); scanf(%s,command);<--seg faults after input has been received. printf(\ncommand:%s\n,command);
int main(void) { char tmp, arr[100]; int i, k; printf(Enter a string: ); scanf_s(%s,
FILE *out=fopen64(text.txt,w+); unsigned int write; char *outbuf=new char[write]; //fill outbuf printf(%i\n,ftello64(out)); fwrite(outbuf,sizeof(char),write,out); printf(%i\n,write); printf(%i\n,ftello64(out));

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.