online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdint.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #define countof(array) (sizeof(array) / sizeof(array[0])) static const char *TAG = "MX318"; char sendbuf[2000]; size_t nb = 0; #define LOG_FORMAT(letter, format) "[" #letter "]" " %s: " format "\n" #define EFM_LOGE( buf, tag, format, ... ) efm_log_write(buf, tag, LOG_FORMAT(E, format), tag, ##__VA_ARGS__) void efm_log_writev(char *buf, const char *tag, const char *format, va_list args) { int n = 0; nb = (strlen(buf) > 0) ? nb += strlen(buf + nb) : 0; if (strlen(buf) > 0) { printf("Not empty\n"); n = vsnprintf(buf + nb, countof(buf) - nb, format, args); } else { printf("Empty\n"); n = vsnprintf(buf, sizeof(buf), format, args); } if (n < 0) { printf("Failed to print with args"); } } void efm_log_write(char *buf, const char *tag, const char *format, ...) { va_list list; va_start(list, format); efm_log_writev(buf, tag, format, list); va_end(list); } int main() { EFM_LOGE(sendbuf, TAG, "FOO %s, %d", "bar", 123); printf("%s", sendbuf); EFM_LOGE(sendbuf, TAG, "BAR %s, %d", "foo", 321); printf("%s", sendbuf); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue