Search:

Type: Posts; User: MK27

Search: Search took 0.08 seconds.

  1. Replies
    30
    Views
    19,685

    Oh, it will. But unfortunately the fun doesn't...

    Oh, it will. But unfortunately the fun doesn't stop at just 1500 times...



    SUNTANG! THINK! Why is that happening? How many rows did you code that loop to allocate?



    for(r=0; columns;...
  2. Replies
    30
    Views
    19,685

    Main() should return an int. You shouldn't...

    Main() should return an int.

    You shouldn't cast the return value of malloc unless you need to use this code with a C++ compiler.

    So, you do have an infinite loop in there >_<. Add this to the...
  3. Replies
    30
    Views
    19,685

    for(r=0; columns; r++) Is obviously an...

    for(r=0; columns; r++)


    Is obviously an infinite loop, since if columns is 1500, the middle condition will always be true. So this is not your actual code, this is some version of it. Making it...
  4. Replies
    30
    Views
    19,685

    That's what the new code will do, look: i=...

    That's what the new code will do, look:



    i= (int) rand()0; // [sic]
    if (arr[i][j] == 0.0) {
    arr[i][j]= (double) rand()/RAND_MAX;
    if (arr[i][j] > 0.0) {
    m[j]++;
  5. Replies
    30
    Views
    19,685

    It does if the OP is just trying to avoid writing...

    It does if the OP is just trying to avoid writing to the same index randomly more than once, but does not care if the value assigned is a duplicate of one at some other index (which is pretty...
Results 1 to 5 of 5