/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <stdarg.h>
#define WARNING_COLOR "aaa"
void colorful_printf( const char* header, const char* color, const char* fmt, ... )
{
// printf("[%s%s%s] ", color, header, RESET_ANSI_COLOR);
(void) color;
printf("[%s] ", header);
va_list args;
va_start( args, fmt );
vprintf(fmt, args);
va_end( args );
}
void warning_printf( const char* fmt, ... )
{
va_list args;
va_start( args, fmt );
colorful_printf("Warning", WARNING_COLOR, fmt, args);
va_end( args );
}
int main()
{
char msg_warn[] = "Failed to initialize setting";
int *address=157;
printf( "%s address: 0x%2x\n", msg_warn, address );
warning_printf( "%s address: 0x%2x\n", msg_warn, address );
return 0;
}