// 使用前
if (p == NULL) {
fprintf(stderr, "p is NULL!\n");
exit(EXIT_FAILURE);
}
// 使用後
if (p == NULL)
kerrorExit("p is NULL!");
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
void kerrorExit(const char *f, ...)
{
va_list ap;
va_start(ap, f);
vfprintf(stderr, f, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(EXIT_FAILURE);
}| コメント | お名前 | NameLink | |