Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a,b,i,j;
- char **t;
- printf("Nombre de lignes ?");
- scanf("%d", &a);
- printf("Nombre de colonnes ?");
- scanf("%d", &b);
- t = malloc(a*sizeof(char*)); // Allocation de mémoire pour la variable t
- for(i=0; i < a ; i++)
- {
- t[i] = malloc(b*sizeof(char));
- }
- for (i=0 ; i<a ; i++)
- {
- for (j=0 ; j<b ; j++)
- {
- t[i][j]='*';
- t[i][j+1]='\0';
- }
- }
- for (i=0 ; i<a ; i=i+1)
- {
- printf("%s\n",t[i]);
- }
- for(i = 0; i < a; i++)
- {
- free(t[i]);
- }
- free(t);
Add Comment
Please, Sign In to add comment