vectors and arrays
for (i=0; iង i++) matrix[i] = i;
Remember: Array indices start at 0! So the “matrix[20]” will have elements 0 through 19.
int matrix[] = {0,1,78,5};
You can initialize arrays this way...
for (i=0; iង i++) matrix[i] = i;
You can use [] and pointer (*) interchangably.
You must delete arrays with the “delete []” operator.
string = new char[strlen(”hello”) +1];
remember to allocate one extra element for the invisible “0” character in C-strings.
On the left is a veryfrequently found piece of code.