[ create a new paste ] login | about

Link: http://codepad.org/7ciDQ378    [ raw code | output | fork ]

C, pasted on Feb 8:
int array[2][2] = {0, 1, 2, 3};
int i;
int sum = 0;

for (i =0; i < 4; ++i)
{

    int x, y;

    x = i % 2;

    if (x)
    {
        y = 0;
        }
    else
    {
        y = 1;
        }
    sum += array[x][y];
}

printf("%d\n", sum);


Output:
1
2
3
4
5
6
7
8
Line 5: error: expected identifier or '(' before 'for'
Line 5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
Line 5: error: expected identifier or '(' before '++' token
Line 23: error: expected declaration specifiers or '...' before string constant
Line 23: error: expected declaration specifiers or '...' before 'sum'
Line 23: warning: data definition has no type or storage class
Line 23: error: conflicting types for 'printf'
t.c:24: note: a parameter list with an ellipsis can't match an empty parameter name list declaration


Create a new paste based on this one


Comments: