b. Name one language which has it or had it.
c. Classify it according to its semantic mode: in, out, in-out.
b. How do the "&" and "*" operators provide a form of "pass by reference".
c. C++ added some extra parameter passing modes to those in C. What are they? How do they work?
d. What is the advantage of C++'s additional parameter passing modes over C's?
e. Rewrite the following C++ to get the same effect in C using "&" and "*" as C prefix operators:
void flip( int & i) { i = ! i ; }
...
int flop = 1;
...
flip (flop);
Code with tests [ 11flip.cpp ]
Answer [ 11tester.cpp ]
b. What is wrong with Ada's rule?.
c. Give examples of Ada's keyword parameters.
d. Give advantages and disadvantages of keyword parameters.
b. Give an example of how "pass by name" might be used in a special way.
c. Why was it abandoned in Pascal and Algol 68?
d. Does C/C++ #define provide call by name?
e. Give a simple C/C++ program that will prove whether #define uses call by name or not!
b. Show how to write a generic subprogram that returns the larger of two values in one of these languages.
c. What are the advantages of generic subprograms?
b. Name one language that provides co-routines.
. . . . . . . . . ( end of section CS320/10 Questions on Subprograms and Chapter 9) <<Contents | End>>