Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I AM NOT GOOD AT PROGRAM

Name: Anonymous 2009-10-31 17:31


#include <iostream>

int *modi (int *array)
{
    int *start = array;
   
    for (int x = 0; x < 10; x++)
    {
        array[x] = x;
    }
   
    return start;
}
   

int main ()
{
    int arr[10] = { 0 };
   
    for (int x = 0; x < 10; x++)
    {
        std::cout << arr[x];
    }
   
    modi (arr);
   
    for (int x = 0; x < 10; x++)
    {
        std::cout << arr[x];
    }
   
    std::cout << "niggers";
   
    return 0;
}


So I just wrote this. I know what it does, and I know that it works, but I don't know how it works.
int *start dereferences, but the value is undefined, and oh god how the fuck did I make this compile.
Please help.

Name: Anonymous 2009-11-01 13:20

While I do approve of your indentation style(very pleasing to the eyes), I believe you may have too many newlines in your code. By reducing the amount of lines with nothing on them, your code becomes much more readable.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List