Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

detmatrix main.c

By: a guest on Feb 25th, 2012  |  syntax: C  |  size: 0.70 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. // Include the functions to manipulate matrices
  6. #include "functions.h"
  7.  
  8.  
  9. // Height & With of the first matrice
  10. #define H1 3
  11. #define W1 3
  12.  
  13. int main(void) {
  14.   // To generate random numbers
  15.   srand (time (NULL));
  16.  
  17.   // Creation and filling of the first matrice
  18.   int **mat1 = init_matrice(H1, W1);
  19.   mat1 = fill_matrice(mat1, H1, W1);
  20.  
  21.   // Display the first matrice
  22.   display_matrice(mat1, H1, W1);
  23.   printf("\n");
  24.  
  25.   // création de la seconde matrice
  26.   int **mat2 = init_matrice2(2, 2);  
  27.   mat2 = new_matrice(mat1, W1, 1);
  28.  
  29.   // affiche la nouvelle matrice
  30.   display_matrice(mat2, 2, 2);
  31.   printf("\n");
  32.  
  33.   return 0;
  34. }