Remark: The run-time stack is the area of memory where local variables of functions are placed. Local variables are allocated automatically when a function starts, and they are deallocated automatically when the function returns.
Remark: The heap is the area of memory where memory that is allocated using new is located. Memory in the heap is allocated explicitly using new, and deallocated explicitly using delete.
void fourteen() { int* s; int* p = new int; int* q = p; int* r = new int; *p = 8; s = p; *q = 25; *r = *s; q = r; cout << "*p = " << *p << endl; cout << "*q = " << *q << endl; cout << "*r = " << *r << endl; cout << "*s = " << *s << endl; }
*p = 25
*q = 25
*r = 25
*s = 25
bool allPositive(List L) { if(isEmpty(L)) return 1; else if(head(L) <= 0) return 0; else return allPositive(tail(L)); }
void matrixAdd(double A[10][10], double B[10][10], double C[10][10]) { int i,j; for(i = 0; i < 10; i++) { for(j = 0; j < 10; j++) { C[i][j] = A[i][j] + B[i][j]; } } }