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

C is hard -.-"

Name: Anonymous 2013-03-09 0:25



float ran();//Returns a float value in the range [0.0,2.0]

int main(int argc, char *argv[]){

  long double return_value=0.0;
  unsigned integer x,y=0;

  y-=1;

  for(x=0;x<y;x++)return_value+=ran();

  return_value/=y;


 return (int)return_value;


}


What are the chances of this program ending correctly?

Name: Anonymous 2013-03-09 0:30

0%

Name: Anonymous 2013-03-09 0:43

100%.

Name: Anonymous 2013-03-09 2:02

If by correctly, you mean deterministically, then 0%.

Name: Anonymous 2013-03-09 2:18

>unsigned integer x,y=0;
>y-=1;

i bet you were a bad boy/girl and pulled the legs off of bugs -_-

Name: Anonymous 2013-03-09 3:00

t'will always return 0

Name: Anonymous 2013-03-09 3:54

>>5
I'm not a fag so I make MORE READABLE with TYPEDEF
#typedef int integer

Name: Anonymous 2013-03-09 4:16

>>7
is it better than
#define integer int
?

Name: Anonymous 2013-03-09 7:10

>>7,8
Congratulations, I cringed.

Still better than typedef char *LPCSTR;

Name: Anonymous 2013-03-09 7:19

is the distribution of the return value of ran() flat?
if so, answer should be 50%, no?

Name: Anonymous 2013-03-09 8:05

y = -1;
for(x=0;x<y;x++) return_value += ran(); <- never executes

Name: Anonymous 2013-03-09 9:33

>>11
unsigned

Name: Anonymous 2013-03-10 10:29

This is because you are using a language that discourages higher level thinking and encourages primitive thinking. C is teaching you to be a programming ape. What you need is a language that lets you think about the problem/solution, not one that gets in your way with silly things like syntax.

If it ain't Lisp, it's crap.

Name: Anonymous 2013-03-10 11:01

>>12 lol

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