Thread: Grrrrr, I need help

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    23

    Grrrrr, I need help

    This is sad... ...but what does this statement do?, I can't understand the "++y/x+" part. The rest is fine...

    printf( ++y/x+"\0 %d \n", x);


    Here is the complete code

    Code:
    #include <stdio.h>
    
    int main(x,y)  {
          for(;x++;)  {
             for(y=2;x%y;) {
                printf( ++y/x+"\0 %d \n", x);
             }
          }
          return 0;
    }

    Thanks for any help.
    Last edited by peradox; 02-14-2005 at 11:39 PM.

  2. #2
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    Code:
     int main(x,y)
    whats that?? that is wrong..thats not the way main takes parameters...you would have to specify the type, that is int or char or whatever for x and y.

    Code:
    for(;x++;)
    the general syntax for the for loop is
    Code:
     for(initialvalue;condition;increment\decrement)
    i doubt your program will ever reach an end with your code.

    also, stuff like y++/x++ results in undefined behaviour..if you want to increment, try y+=1
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > but what does this statement do?
    This is obfuscated code - relax, it's just a bit of fun.

    Though if someone is teaching you this as being acceptable 'C' coding, then leave the class now, because your tutor is a grade-A MORON.

    > x+"\0 %d \n"
    A small hint, this is equivalent
    "\0 %d \n"[x]
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    23
    THAT IS NOT MY CODE. just to get that clear... ...I don't code lke that and am not taking a class. I just found this code on the internet and didn't understand it, that's all. I can understand your initial disgust though ... ...

    Anyway, any more help???

Popular pages Recent additions subscribe to a feed