About 481,000 results
Open links in new tab
  1. Output single character in C - Stack Overflow

    Jun 29, 2009 · When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?

  2. c - Printing data type char with printf () - Stack Overflow

    Sep 26, 2017 · The printf() function uses the format specifier %s to print char *. The standard does not specify how char is implemented as signed or unsigned. So when char is …

  3. c - Printing a Char * - Stack Overflow

    May 25, 2017 · 27 You want to use %s, which is for strings (char*). %c is for single characters (char). An asterisk * after a type makes it a pointer to type. So char* is actually a pointer to a …

  4. How to correctly printf strings and characters with %s and %c

    25 %c is designed for a single character a char, so it print only one element.Passing the char array as a pointer you are passing the address of the first element of the array (that is a single …

  5. How to print a char array in C through printf? - Stack Overflow

    May 13, 2018 · The thing is that you are using C Style Strings, and a C Style String is terminated by a zero. For example if you'd want to print "alien" by using a char array:

  6. c++ - Printing a char with printf - Stack Overflow

    Jan 19, 2011 · 59 %d prints an integer: it will print the ascii representation of your character. What you need is %c:

  7. c - Char pointers and the printf function - Stack Overflow

    Oct 12, 2016 · For your first question, the printf function (and family) takes a string as first argument (i.e. a const char *). That string could contain format codes that the printf function …

  8. printf - How to print an unsigned char in C? - Stack Overflow

    Apr 1, 2013 · Even with ch changed to unsigned char, the behavior of the code is not defined by the C standard. This is because the unsigned char is promoted to an int (in normal C …

  9. The simplest way of printing a portion of a char[] in C

    Aug 4, 2015 · 37 Let's say I have a char* str = "0123456789" and I want to cut the first and the last three letters and print just the middle, what is the simplest, and safest, way of doing it? …

  10. Printing chars and their ASCII-code in C - Stack Overflow

    Sep 24, 2009 · How do I print a char and its equivalent ASCII value in C?