Salut,

Voila, j'ai un ex a faire en C, il faut que je réalise la fusion de 2 tableaux dans un seukl tableau trié, je vous demande pas de me faire mon ex a ma place bien au contraire mais juste de m'aider a comprendre ou je fait erreur
En passant j'ai trouver ça mais ça ne me convient pas

Voila ce que j'ai commencer à faire :
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*                    			**
**                     			**   
**   Auteur   :   Oyo         		**
**   Fichier   :   Ex 23 FuTab 	**
**                    			**
**  Fusion 2 tableaux        		**
**  ~> 20 x 2                 		**
**  ~~> 1 tab 40 val tri ASC 	**
**                    			 */
#include <stdio.h>
#include <stdlib.h>
 
#define N 2
#define O 2
#define Z 4
 
int main()
{
	float tab[N],ztab[O], ytab[Z];
	int j, i, temp;
 
	printf("\n~~~~ Saisi Tableau 1 ~~~~\n\n");
	for(i = 0; i < N; i++)
	{
		printf("Essai %d: ", i + 1);
		fflush (stdout);
		scanf("%f", &tab[i]);
	}   
	printf("\n~~~~ Saisi Tableau 2 ~~~~\n\n");
	for(i = 0; i < O; i++)
	{
		printf("Essai %d: ", i + 1);
		fflush (stdout);
		scanf("%f", &ztab[i]);
	}
 
	for(i = 0; i < N-1; i++)
	{
		for(j = i+1; j < N; j++)
		{
			if (tab[i]>tab[j])
			{
				temp = tab[j];
				tab[j] = tab[i];
				tab[i] = temp;
				fflush (stdout);
				}
			}
	}
 
	for(i = 0; i < O-1; i++)
	{
		for(j = i+1; j < O; j++)
		{
			if (ztab[i]>ztab[j])
			{
				temp = ztab[j];
				ztab[j] = ztab[i];
				ztab[i] = temp;
				fflush (stdout);
			}
		}
	}
 
	printf("\n --------------------------------\n"   
		"| Tri Tableau 1 | Tri Tableau 2  |\n"
		"|--------------------------------|\n"
		"|      OK       |        OK      |\n"
		" --------------------------------\n"
		);
 
	for ( i = 0 ; i <Z ; i++)
	{
		ytab[i] = tab[i];
		ytab[i] = ztab[i]; 
		fflush (stdout);
	}
 
	printf("|      Fusion Tableau 1 & 2      |\n"
		" --------------------------------\n"
		"|              OK                |\n"
		" --------------------------------\n"
		"|         Tri Tableau 3          |\n"
		" --------------------------------\n"
		"|              OK                |\n"
		" --------------------------------\n\n"
		);
 
	for(i = 0; i < Z; i++)
	{
		for(j = i+1; j < Z; j++)
		{
			if (ytab[i]>ytab[j])
			{
				temp = ytab[j];
				ytab[j] = ztab[i];
				ytab[i] = temp;
				fflush (stdout);
			}
		}
		printf(" %.0f", ytab[i]);
	}
 
	printf("\n\n");
	system("pause");
	return 0;
}
Mon code block sur strcpy(), je pensais que c'était une bonne solution de copier et puis de concaténer les tableaux pour n'en avoir plus qu'un.. mais bon ça semble pas fonctionner :/

J'avais vu que est du type char *strcpy(char *but, const char *source) mais j'ai du mal à comprendre a quoi cela correspond réelement..

Merci par avance,
Cordialement.