ROT13 “Encryption”

ROT13 is a very simple “encryption” achieved by shifting each letter with the 13th letter further in the alphabet (with wrap-around). That is, in English alphabet, A becomes N, B becomes O, N becomes A, etc.

This encryption (or a more general form of it, where rotation can be by any number, with or without wrap-around) was once used for military communications by Julius Caesar.

It’s used today in the Internet (and once, in Usenet) mostly to hide spoilers (similar to Continue reading →

Define A Macro In C With A Variable Number Of Arguments

Say you want to wrap a function like printf() (which receives a variable number of arguments) with a macro. This is how to do it:


#define PRINT_DEBUG(fmt, args...)  printf("DBG:"fmt, ##args)

That is, declare them as args… and use them with ##args.

Note: The word args has nothing special, you could similarly use somethingelse… and ##somethingelse. Just in case you were wondering ;-)