This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

what Is wrong With This code

i tried this code and it is failes! what is wrong?


#define BEGIN  {          // use proper blocks
#define END    }

#define INC ( i) i = i + 1   // invrement variable i


int* testtest()
BEGIN
    int  buf1 [ 10 ];             // make a buffer of variables
    int * buf2  10 ] ;        // and make a copy for pointing

    int i ;                           // use a variable to count

    for (i = 0; i == 10 ? 0 : -1 ; INC ( i ) )  // nullify variabel to zero
    BEGIN
        buf1 [ i ] = i;          / / save variable to buffer
        * buf2 [ i ] = & i;              // save variable to other one
    END;

    // ..

  println ( 'the variable is ' + i )
END;
<pre<


Parents
  • hi

    i looked to the code but it is very complicated and i do not understand what it calculates .

    but i have fixed the code and it compiles and it now works.

    
    #include <stdio.h>
    
    #define BEGIN  {          // use proper blocks
    #define END    }
    
    #define INC ( i) i = i + 1   // invrement variable i
    
    
    int* testtest()
    BEGIN
        int  buf1 [ 10 ];             // make a buffer of variables
        int * buf2 [ 10 ] ;        // and make a copy for pointing
    
        int i ;                           // use a variable to count
    
        for (i = 0; i == 10 ? 0 : -1 ; INC ( i ) )  // nullify variabel to zero
        BEGIN
            buf1 [ i ] = i;          / / save variable to buffer
            buf2 [ i ] = & i;              // save variable to other one
        END;
    
        // ..
    
      printf ( "the variable is %d\n", i );
    
      return 0;
    END
    

Reply
  • hi

    i looked to the code but it is very complicated and i do not understand what it calculates .

    but i have fixed the code and it compiles and it now works.

    
    #include <stdio.h>
    
    #define BEGIN  {          // use proper blocks
    #define END    }
    
    #define INC ( i) i = i + 1   // invrement variable i
    
    
    int* testtest()
    BEGIN
        int  buf1 [ 10 ];             // make a buffer of variables
        int * buf2 [ 10 ] ;        // and make a copy for pointing
    
        int i ;                           // use a variable to count
    
        for (i = 0; i == 10 ? 0 : -1 ; INC ( i ) )  // nullify variabel to zero
        BEGIN
            buf1 [ i ] = i;          / / save variable to buffer
            buf2 [ i ] = & i;              // save variable to other one
        END;
    
        // ..
    
      printf ( "the variable is %d\n", i );
    
      return 0;
    END
    

Children