int vector[100]; const int ROWSIZE = 10; const int COLSIZE = 25; float matrix[ROWSIZE][COLSIZE]; float vect[COLSIZE];
int one[5] = {2,4,8,16,32}; int two[3][4] = {{1,2,3,4},{2,4,6,8},{3,6,9,12}}; int three[3][2] = {10,20,30,40,50,60};
int i = 2; int nums[10]; nums[0] = 1; // stores the value 1 in element 0 nums[2*i+1] = 50; // stores the value 50 in element 5
void example(int[]);
void printarr(int arr[], int size) { int i; for (i = 0 ; i < size ; i++) cout << arr[i] << endl; }
int vector[6] = {51,40,75,48,60,46}; printarr(vector,6);
int vector[6] = {51,40,75,48,60,46}; int small = min(vector[2],vector[5]); int min(int one,int two) { if (one < two) return one; return two; }In this example, the parameter one will be a copy of vector[2], which has the value 75, and the parameter two will be a copy of vector[5], which has the value 46. After the call to min, small will contain the value 46.
void example(int[][20]);
void print2D(int arr[][COLS], int ROWS, int COLS) { int i, j; for (i = 0 ; i < ROWS ; i++) for (j = 0 ; j < COLS ; j++) cout << arr[i][j] << endl; }
int vector[2][4] = {20,51,40,75,48,13,60,46}; printarr(vector,2,4);
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2004