私の関数ptr * Os_printf * では2つ以上の引数を出力できますが、私の関数は1つの引数でしか機能しません。例えば関数ポインタの引数リスト
- >
Os_printf("Moon %d %d",55,5);
OUT:
月55 5
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
char db[50];
void test_1(int (*debug)())
{
debug("JOY %d %d \n",4,55);
}
volatile int (*ptr_fscreener)(char * __restrict, const char * __restrict, ...);
void Os_formater(int (*debug)())
{
ptr_fscreener=debug;
}
void Os_printf(const char * __restrict out,void**d)
{
va_list args;
char db[50];
ptr_fscreener(db,out,d);
puts(db);
}
int main(void) {
Os_formater(sprintf);
Os_printf("Moon %d",55);
test_1(printf);
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
/******* OUTPUT For example ******/
Moon 55
JOY 4 55
!!!Hello World!!!
、答えは非常に単純です:のhttp:// WWW。 gnu.org/software/libc/manual/html_node/Variadic-Functions.htmlしかし、あなたの言葉遣いは質問ではなく、声明です。それは伝えにくいです。 – tbert