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

Complete newfag here

Name: Anonymous 2011-01-13 4:09

Hai, I'm a newfag to C++ and to this board so excuse my giant amount of fail.
Why won't this figure out the smallest thing in the array?
http://codepad.org/vaHOX8mW

Name: Anonymous 2011-01-13 4:27

>>8
Why the fuck do you pass smallest as reference?
Why the fuck are you initialising it inside the function?
Why the fuck don't you return a value in a function (int[], int&) -> int)?
How the fuck do you know that the array will be of length 9?
If you know the length, why the fuck don't you make the function (int[9], int&) -> int so it will accepts just 9-elements arrays?
And WHAT THE FUCK IS THAT i + 1 INSIDE THE for LOOP?

int smallest(int *in, int length) {
  int r = in[0], i;
  for (i = 1; i < length; i++)
    if (in[i] < r) r = in[i];
}

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