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

What is this?

Name: Anonymous 2012-11-04 22:55

>warning: conflicting types for 'something' [enabled by default]

If put the main after the functions this doesn't show up, why?

Name: Anonymous 2012-11-04 23:07

If you try to call the function before it's declared the compiler will have to guess its types.

You can put just the declaration above main() and put the definition below.



int dicks(int x);

int main(int argc, char **argv){
    if(argc < 2){
        return 1;
    }

    printf("Dicks! :%d\n", dicks(atoi(argv[1])));

    return 0;
}

int dicks(int x){
    int i;
    int j = 0;

    for(i=0; i<x; ++i){
        j += x % i;
    }

    return j;
}

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