Obfuscated C Code Contest 2006. Please explain sykes2.c

Let’s de-obfuscate it. Indenting: main(_) { _^448 && main(-~_); putchar(–_%64 ? 32 | -~7[__TIME__-_/8%8][“>’txiZ^(~z?”-48] >> “;;;====~$::199″[_*2&8|_/64]/(_&2?1:8)%8&1 : 10); } Introducing variables to untangle this mess: main(int i) { if(i^448) main(-~i); if(–i % 64) { char a = -~7[__TIME__-i/8%8][“>’txiZ^(~z?”-48]; char b = a >> “;;;====~$::199″[i*2&8|i/64]/(i&2?1:8)%8; putchar(32 | (b & 1)); } else { putchar(10); // newline … Read more

How do I use extern to share variables between source files?

Using extern is only of relevance when the program you’re building consists of multiple source files linked together, where some of the variables defined, for example, in source file file1.c need to be referenced in other source files, such as file2.c. It is important to understand the difference between defining a variable and declaring a … Read more

What does “static” mean in C?

A static variable inside a function keeps its value between invocations. A static global variable or a function is “seen” only in the file it’s declared in (1) is the more foreign topic if you’re a newbie, so here’s an example: #include <stdio.h> void foo() { int a = 10; static int sa = 10; … Read more

How do function pointers in C work?

Function pointers in C Let’s start with a basic function which we will be pointing to: int addInt(int n, int m) { return n+m; } First thing, let’s define a pointer to a function which receives 2 ints and returns an int: int (*functionPtr)(int,int); Now we can safely point to our function: functionPtr = &addInt; … Read more

What is “:-!!” in C code?

This is, in effect, a way to check whether the expression e can be evaluated to be 0, and if not, to fail the build. The macro is somewhat misnamed; it should be something more like BUILD_BUG_OR_ZERO, rather than …ON_ZERO. (There have been occasional discussions about whether this is a confusing name.) You should read … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)