CIS 2500 Chapter Notes - Chapter 1.8: Null Character
45 views3 pages
9 Jan 2019
School
Department
Course
Professor
Document Summary
The called function is given the value of the argument as a temporary variable, not the original. Calling by reference provides reference to the original variable. Call by value helps to compact programs, as there are fewer extraneous variables. This is because parameters are treated as local variables. Variable n is a temporary variable, and is counted down until it becomes 0 then is no longer needed. Whatever is done to n in power has no effect on the argument n that is passed to power. To modify the variable, the address of the variable (a pointer to the variable) must be provided, and the function must declare the parameter to be a pointer. Program which reads a set of text lines and prints the longest. Function getline gets the nextline of input and returns a signal about possible end of file. Copy function copies the new line to a safe place.