Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. /* Federico Vallese, 0000797422*/
  2. int main()
  3. {
  4.  
  5.         int i;
  6.         int righe=3;
  7.         int colonne=3;
  8.         int** B;
  9.         B= (int**) malloc(righe*sizeof(int*));
  10.         for (i=0;i<colonne;i++){
  11.             B[i]=(int*)malloc(colonne*sizeof(int));
  12.         }
  13.  
  14.  
  15.         int c;
  16.         int r;
  17.         int k=1;
  18.         for(r=0;r<righe;r++){
  19.             for(c=0;c<colonne;c++){
  20.                 B[r][c]=k;
  21.                 k++;
  22.             }
  23.         }
  24.  
  25.         printf("B[0][0] = %d \n",B[0][0]);
  26.         printf("B[1][0] = %d \n",B[1][0]);
  27.         printf("B[0][1] = %d \n",B[0][1]);
  28. return (0);
  29. }
  30. // vede prima le colonne
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement