Thursday, January 20, 2011

1.5 Character Input and Output

  • A text stream is a sequence of characters divided into lines
1.51 File Copying: getchar() , putchar()
  • getchar function reads the next input character from a text stream and return that as its value
  • putchar function prints the contents of a variable as a character
  • File Copying:
 
  • EOF: End of File , Numeric Value: 0xFF

1.52 Character Counting

  • Character Couting:

  • ++ operator : increment by 1
  • -- operator : decrement by 1
  • ++ & -- operator can be prefix or postfix; different values in expressions
Character counting













1.53 Line Counting
  • Counting line = counting newlines
  • A character written between single quotes represents an integer value equal to the numerical value of the character in the machine's character set

Line Counting















    1.54 Word Counting
    • Counting word = counting blank , tab or newlines

    No comments:

    Post a Comment