Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs-142:reference-parameters [2015/10/12 23:06]
kseppi created
cs-142:reference-parameters [2015/10/13 20:31] (current)
kseppi
Line 16: Line 16:
 } }
  
-// reference ​paramenters ​allow us to change the value of something+// reference ​parameters ​allow us to change the value of something
 // passed to us. But the "​normal function"​ approach is preferred. // passed to us. But the "​normal function"​ approach is preferred.
 void foo3(int &x) { void foo3(int &x) {
Line 22: Line 22:
 } }
  
-// We can use reference ​paramentes ​to get more than one value back+// We can use reference ​parameters ​to get more than one value back
 // to the caller. There are other ways to solve this problem, but // to the caller. There are other ways to solve this problem, but
-// this approach is use. Probabaly ​not great if you are trying to+// this approach is use. Probably ​not great if you are trying to
 // get 23 values back. More on that latter. // get 23 values back. More on that latter.
 void return_more_than_one_thing(int in1, int in2, int &out1, int &out2) { void return_more_than_one_thing(int in1, int in2, int &out1, int &out2) {
Line 41: Line 41:
 // another use of references is to return values and to use // another use of references is to return values and to use
 // the return only for returning the status of the operation. // the return only for returning the status of the operation.
-int divide(double dividend, double divisor, double quotient) {+int divide(double dividend, double divisor, double ​&quotient) {
     if (divisor == 0){     if (divisor == 0){
         return 0;         return 0;
cs-142/reference-parameters.txt ยท Last modified: 2015/10/13 20:31 by kseppi
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0