summaryrefslogtreecommitdiff
path: root/reference/CPLUSPLUS/EXAMPLES/refvar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'reference/CPLUSPLUS/EXAMPLES/refvar.cc')
-rw-r--r--reference/CPLUSPLUS/EXAMPLES/refvar.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/reference/CPLUSPLUS/EXAMPLES/refvar.cc b/reference/CPLUSPLUS/EXAMPLES/refvar.cc
new file mode 100644
index 0000000..1e8ddd5
--- /dev/null
+++ b/reference/CPLUSPLUS/EXAMPLES/refvar.cc
@@ -0,0 +1,26 @@
+/************************************************************************
+ *
+ * Purpose: Demonstrate the use of reference variables.
+ * Author: M J Leslie
+ * Date: 26-Oct-98
+ *
+ ************************************************************************/
+
+
+#include <stdio.h>
+
+int Square(int &Val);
+
+main()
+{
+ int Number=10;
+
+ Square(Number);
+
+ printf("Number is %d\n", Number);
+}
+
+int Square(int &Val)
+{
+ Val *= Val;
+}