Thursday, September 23, 2010

Crazy piece of C code!!

// Crazy C code i came across.
// I donno whats happening internally though!! If Anyone understood, let me know!!

// Output : skcuS++C¿ð

#include
double m[] = {7709179928849219.0, 771};
int main()

{
          m[1]-- ? m[0]*=2 , main(): printf(m);
}

3 comments:

  1. Found it too just today in a forum signature, apologies for posting late.
    Doesn't seem that cryptic.
    -Decrement m[1] //initially 771
    - while m[1] > 0 multiply m[0] by 2 and store in m[0] //note type double
    - when m[1] becomes 0
    print the 64-bit value as string of 8 ASCII chars.

    code is simple, but usage of IEEE754 bitshift is astonishing for a newb like me.

    ReplyDelete
  2. forgot to add:
    ... and m[1] becomes the /0 string terminator :)

    ReplyDelete
  3. forgot to add:
    ... and m[1] becomes the /0 string terminator :)

    ReplyDelete

Hey ther,
Thanks for visiting my blog.
Feel free to write whats in ur mind about the post you read..!! A Good day to u!!