Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define N 12
- #define R 3
- #define C 3
- //Scrivere una funzione che stampi un vettore
- void stampaVettore(int array[], int num);
- void stampaMatrice(int matrix[R][C]);
- //Scrivere funzione che stampi matrice utilizzando quella del vettore
- int main() {
- //non serve il pointer in sto caso
- int array[N] = {1,2,3,4,5,6,7,8,9,10, 11, 12};
- int matrix[R][C] = {{1,5,6},
- {1,4,1},
- {5,2,1}
- };
- int i,j;
- // stampaVettore(array, N);
- printf ("\n");
- /* for (i=0; i < C; i++){
- for (j=0; j < R; j++){
- printf ("%d",matrix[i][j]);
- }
- printf ("\n");
- }
- */
- stampaMatrice(matrix);
- }
- void stampaVettore(int array[],int num){
- int i;
- for (i=0; i < num; i++){
- printf ("%d ", array[i]);
- }
- }
- void stampaMatrice(int matrix[R][C]) {
- stampaVettore(matrix,R);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement