Skip to content

Instantly share code, notes, and snippets.

@sakibguy
Forked from preslavmihaylov/macros-in-c-5.cpp
Created March 8, 2021 15:47
Show Gist options
  • Save sakibguy/9441718b83880362fc942a7a1732329d to your computer and use it in GitHub Desktop.
Save sakibguy/9441718b83880362fc942a7a1732329d to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
void printError(int errorCode, string msg = "No message")
{
cerr << "Error code: " << errorCode << " (" << msg << ")\n";
}
int main(int argc, char *argv[])
{
printError(9, "Bad alloc");
printError(8);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment