return
void
functions only (and main
)
catch
in the function
exit
)
void resize(int *a, int n) { // equivalently int [] a int *temp = new int[2*n]); for (int i = 0; i < n; i++) temp[i] = a[i]; a = temp; }
void resize(int *&a, int n)
int max(int, int); double max(double, double); … int i = max(1, 12); double d = max(2.0, 3.5); int i = max(1, 2.5); // error -- ambiguity i = max(1, (int)2.5); // ok d = max((double)1, 2.5); // ok
nullptr
); §12.2.1.nullptr
; there is no such mechanism for references (or most pre-defined types and class objects)
#define TWICE(x) 2*x … int a = 2; int b = TWICE(a+1); // expands to 2*a+1 -> 5, not 6 cout << b;