Monthly Archives: November 2015

CoD – Code of the Day – 1447441471

#include <stdio.h>

enum {WARNING, ERROR, INFO, SUCCESS};

char const *msg(int type);

int main (int argc, char **argv)
{

puts(msg(INFO));

puts(msg(0));
return 0;
}

char const *msg(int type)
{

switch (type)
{
case WARNING:
return “Warning message!”;
case ERROR:
return “Error message!”;
case INFO:
return “Info message!”;
case SUCCESS:
return “Success message!”;

}

return NULL;
}