Bonjour, voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
void Affichertab(const char tab[4][4])
{
    int i,j;
    for(i=0;i<4;i++)
    {
        printf("\t");
        for(j=0;j<4;j++)
        {
            printf("%c ",tab[i][j]);
        }
        printf("\n");
    }printf("\n");
}
 
void Retournertab(char tab[4][4])
{
    char temp[4][4]={"0"};
    int i,j;
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
            temp[j][3-i]=tab[i][j];
 
        }
    }
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
            tab[j][3-i]=temp[j][3-i];
        }
    }
}
 
void Exo4()
{   
    int taille_tableau;
    printf("taille du tableau?\n");
    scanf("%d",taille_tableau);
 
    char tab[4][4]={{'l','3','3','r'},
                      {'l','n','m','3'},
                      {'3','0','4','v'},
                      {'w','d','g','0'}};
    printf("Tableau statique:\n");
    Affichertab(tab);
    Retournertab(tab);
    Affichertab(tab);
Il marche, cependant j'aimerais pouvoir demander a l'utilisateur la taille n de son tableau ( carré ) et lui faire remplir.
Il faut d'abord que j'alloue de la mémoire ( malloc ) et que je libère celle ci ( free )

Suis un peu bloqué, c'est frustrant

Pouvez vous m'aider ? merci