CIS126 Unit 5 Discussion.docx - Unit 5 Discussion Formatting I\/O Sorry for the lateness I decided on the program D The code prints each character in the

CIS126 Unit 5 Discussion.docx - Unit 5 Discussion...

This preview shows page 1 - 3 out of 3 pages.

Unit 5 Discussion: Formatting I/O Sorry for the lateness, I decided on the program D. The code prints each character in the array in different lines. The output would be a string output using the character array. H A P P Y B I R T D A Y This output is managed by a format specifier in the printf statement. Format specifier: "\t%c \n" \t - refer to tab character %c - a single character " " (space) - whitespace character \n - new line
Image of page 1
In the code, we iterate through each character in the array and print them using the format specifier. In the new code #include <stdio.h> int main(void) { puts("String output using character array"); char h[] = "Happy Birthday";
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Spring '20
  • Character encoding, ASCII, #include, printf, Whitespace

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture