![]() |
CMPT 212
Spring 1998
|
// bool.h #ifndef _bool_h_ #define _bool_h_ #if (__BORLANDC__ < 0x500) enum bool { false, true }; #endif #endifThe value __BORLANDC__ is set by the Borland system header files to be equal to the compiler's version number. This example may have to be adjusted to work with Microsoft's compilers. (Note that there are two underscores before and after BORLANDC.)
int x = 3; // x is an integer. int& y = x; // y is a reference to an integer.
int& y; // causes a compiling error.
int& y = x;as meaning "y is another name for x".
void f(int x) { x = 4; return; } int main() { int y = 3; f(y); return 0; }
void f(int& x) { x = 4; return; } int main() { int y = 3; f(y); return 0; }
![]() Return to lecture notes index |
|
This page is maintained by simpson@cs.sfu.ca. | Last updated on 19 Jan 1998. |