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
 
void affichage_matrice(int **t, int n ) 
{int i, j; 
	for ( i=0; i<n; i++) //On atteint nbsommet +1 
		{	for (j=0; j<n; j++)
				printf ("  %d ",t[i][j]); 
 
			printf("\n");
 
		}
}
 void allocation ()
{
char ch[BUFFER];
int i,s1,s2,w;
 
	while (fgets(ch,BUFFER,stdin)) 
	{
 
		if (sscanf(ch,"%d %d %d" ,&s1 ,&s2 ,&w)==3) //s'il lit 3 arguments il les stocke dans la matrice d'adjacence 
						{						
							t[s1][s2]=w;
							t[s2][s1]=w;
							NbAretes++;
						}			
				else if (sscanf(ch,"%d",&NbSommets)==1) // <=> a lu le nombre de sommets 
					{ 
						t= malloc( (NbSommets+1) * sizeof(int) );
						for (i=0; i<NbSommets+1; i++)
							t[i]= malloc((NbSommets+1)* sizeof(int));
						affichage_matrice(t,NbSommets+1);
 
					}
	}
 
 
}
voici mes codes.
Nom : Capture du 2016-11-26 21-21-32.png
Affichages : 371
Taille : 10,4 Ko
Et voici l’exécution
Le problème : pourquoi il m'affiche des adresse ? et comment je peut le corrigé ?
Et merci pour vos réponses .