Bonjour, ce code vous semble-t-il ok ?

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
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
 
 
char buffer[200];
 
 
void myprintf2(const char *s, ...)
{
	va_list args;
 
	va_start(args, s);
 
	vsnprintf(buffer, 100, s, args);
 
	printf(buffer);
 
	va_end(args);
}
 
 
void myprintf(const char *s, ...)
{
	va_list args;
 
	va_start(args, s);
 
	myprintf2(s, args);
 
	va_end(args);
}
 
 
int main()
{
	myprintf("hey\n");
 
	return 0;
}
Je n'ai pas l'habitude d'imbriquer les va_trucs.
En tout cas il marche avec gcc, mais je ne suis pas certain que ce soit normal.