CSC209H1 Lecture 13: CSC209 LEC 13 io_conversions

61 views2 pages
4 Feb 2019
School
Course
Professor

Document Summary

Consider the following c statement: char ch = "a"; one byte of memory is allocated for the variable ch and in the. Rst row of table below we see that the bits are set to 01000001. This is the 65, the ascii code for the letter a". (aside: We don"t expect you to memorize any ascii codes. You can look them up in this table http://www. ascii-code. com. ) Hint for the table: the ascii code for 5" is 53, in decimal. Notice in the second row that when we use fprintf to print a string containing the uppercase a to a le, one byte is written to the le. Again it is the ascii code for a. 0 1 0 0 0 0 0 1 ot ooo. 10100001j char ch = "a"; fprintf(fp, "%c", ch); fprintf(fp, "5"); char ch = "5"; fprintf(fp, "%c", ch); int i = 5; ana int i = 5; fprintf(fp, "%d", i); byte.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents