About 2,410,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. 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 …

  6. 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 …

  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. How can I print a quotation mark in C? - Stack Overflow

    Aug 2, 2012 · In an interview I was asked Print a quotation mark using the printf() function I was overwhelmed. Even in their office there was a computer and they told me to try it. I tried like this: void …

  9. 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 …

  10. How can I convert an int to a string in C? - Stack Overflow

    How do you convert an int (integer) to a string? I'm trying to make a function that converts the data of a struct into a string to save it in a file.