Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. CSP* creer_CSP(int nbVar, int nbVal){
  2.     printf("Création d'un CSP vide \n");
  3.    
  4.     CSP *csp = malloc(sizeof(CSP));
  5.    
  6.     csp->nbVal = nbVal;
  7.     csp->nbVar = nbVar;
  8.     csp->DaPi = 0;
  9.    
  10.     csp->domaines = malloc(nbVar*sizeof(int));
  11.     for(int i=0 ;i<nbVar; i++){
  12.         csp->domaines[i] = malloc(nbVal*sizeof(int));
  13.     }
  14.    
  15.     csp->contraintes = malloc(nbVar*sizeof(Matrice));
  16.     for(int i=0 ;i<nbVar; i++){
  17.         csp->contraintes[i] = malloc(nbVar*sizeof(Matrice));
  18.     }
  19.    
  20.     for(int i=0 ;i<nbVar; i++){
  21.         for(int j=0;i<nbVar;j++{
  22.             csp->contraintes[i][j] = creer_matrice(nbVal);
  23.         }
  24.     }
  25.     printf("Fin de la création du CSP \n");
  26.    
  27.     return csp;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement