Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Federico Vallese , 0000797422 \\
- #include <stdlib.h>
- #include <stdio.h>
- int main()
- {
- int i=0;
- int B[3][3] = {1,2,3,4,5,6,7,8,9};
- printf("B[0][0] = %d \n", B[0][0]);
- printf("B[1][0] = %d \n", B[1][0]);
- printf("B[0][1] = %d \n", B[0][1]);
- int **B2=(int**) malloc(3*sizeof(int*));
- for (i=0; i<3; i++)
- {
- B2[i]=(int*) malloc(3*sizeof(int));
- }
- B2[0][0]=1;
- B2[1][0]=2;
- B2[2][0]=3;
- B2[0][1]=4;
- B2[1][1]=5;
- B2[2][1]=6;
- B2[0][2]=7;
- B2[1][2]=8;
- B2[2][2]=9;
- printf(" Matrice B2: \n");
- printf(" %d \t\t %d \t\t %d \n", B2[0][0],B2[0][1], B2[0][2]);
- printf(" %d \t\t %d \t\t %d \n", B2[1][0],B2[1][1], B2[1][2]);
- printf(" %d \t\t %d \t\t %d \n", B2[2][0],B2[2][1], B2[2][2]);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement