lec2_bitshexints - Bits Bytes and Memory Marco Gruteser 331...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Some slides adapted from Bryant, O’Hallaron, and Nath. 1 Bits, Bytes, and Memory Marco Gruteser 331 Computer Architecture and Assembly Language
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Output Examples (continued) Formatting instructions can contain additional information: Min Field Width . Precision Min Field Width The minimum number of spaces the number is allow to occupy. Precision Float: Num of digits to the right of decimal point Int: Min Number of digits to be printed String: Number of chars from string to print int iv = 12345; printf("%2.3d\n", (iv)); printf("%10d\n", (iv)); printf("%10.5f\n", (3.1456123)); printf("%10.2f\n", (3.1456123)); printf("%.2f\n", (3.1456123)); 12345 12345 3.14561 3.15 3.15
Image of page 2
3 Examples of Input Many of the same formatting characters are available for user input. scanf("%c", &nextChar); reads a single character and stores it in nextChar scanf("%f", &radius); reads a floating point number and stores it in radius scanf("%d %d", &length, &width); reads two decimal integers (separated by whitespace), stores the first one in length and the second in width
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern