About 1,910,000 results
Open links in new tab
  1. 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 char) and then …

  2. How to print a string in C++ - Stack Overflow

    How to print a string in C++ [closed] Asked 14 years, 9 months ago Modified 7 years ago Viewed 600k times

  3. Printing a string in C using a function - Stack Overflow

    Sep 25, 2010 · I'm brand new to C and am trying to learn how to take a string and print it using a function. I see examples everywhere using while(ch = getchar(), ch >= 0), but as soon as I put it into …

  4. c++ - How to use printf with std::string - Stack Overflow

    48 Use myString.c_str() if you want a C-like string (const char*) to use with printf.

  5. Printing a string in C - Stack Overflow

    Oct 1, 2018 · 1 I understand that in C, a string is an array of characters with a special '\0' character at the end of the array. Say I have "Hello" stored in a char* named string and there is a '\0' at the end of …

  6. How to print in C - Stack Overflow

    0 printf is a fair bit more complicated than that. You have to supply a format string, and then the variables to apply to the format string. If you just supply one variable, C will assume that is the format …

  7. How do I print the percent sign(%) in C? - Stack Overflow

    The two-character sequence %% is defined to print a single %. To understand why % can't work, remember that the backslash \ is the compiler's escape character, and controls how the compiler …

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

    char *str = "0123456789"; printf("%.6s\n", str + 1); The precision in the %s conversion specifier specifies the maximum number of characters to print. You can use a variable to specify the precision at …

  9. c - How to format strings using printf () to get equal length in the ...

    will print two columns of the same width of whatever length the two strings header1 and header2 may have. I don't know if all implementations have the %n, but Solaris and Linux do.

  10. How do I properly 'printf' an integer and a string in C?

    Aug 3, 2019 · A < I'm trying to read the first character as a string and the third character as an integer, and then print those out on the screen. The first character always works, but the screen would just …