CIS 2500 Chapter Notes - Chapter 1.5: Comefrom, Newline, While Loop

48 views4 pages

Document Summary

Getchar reads the next input character from a text stream and returns its value. Characters usually come from keyboard or input from files. Putchar prints a character each time it is called. Prints the contents of the integer variable d as a character. Char is used for character data, however in the example above, we used int. Getchar returns a distinctive value when there is no more input, the value is called eof for. C must be declared a type big genough to hold any value returned by getchar. Char is not big enough to hold eof, so we use int. ++nc is the same as nc = nc + 1. -nc is the same as nc = nc - 1. Character counting uses a long variable instead of an int, a long is 32 bits, while an int can be 16 bits. A double can also be used for even bigger numbers.

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

Related Questions