Hey guys,
I'm in need of spawning a separate program from my original (parent) program, which in itself is not a problem (yes, i checked out the FAQ at FAQ > Run a program from within a program -...
Type: Posts; User: otaconBot
Hey guys,
I'm in need of spawning a separate program from my original (parent) program, which in itself is not a problem (yes, i checked out the FAQ at FAQ > Run a program from within a program -...
Hm? I think I am. I might have been using the term list, but actually meaning just a basic array. Unless you mean something else here.
Oh, and @edit: its just a bit string, not even references....
Its relatively small..as in a bits: num_vars*(sizeof(char)) , but the length of it is unknown, my test benchmarks are about 100-2000 variables...but industrial testing can easily be 100x that ..so...
Hey guys,
I think this question boils down to dynamically allocating memory. Is it more expensive/efficient allocating memory once, if I know the max size I will need (even if I'm likely to use...
Hey guys,
I'm still getting used to C, but need to run a really large simulations in it. I have a very n00b question about how C handles memory etc.
More specifically, is it risky to...
/me hugs nonoob
Elegant and efficient :) Exactly what I needed! That was quick, thank you :)
Hey guys,
So my current problem, after great simplifications boils down to this:
Lets say you have a 100 numbers, and I want to pick a random one. If its not 'right' I need to pick another one...
Wow, two things... you're right, after casting it to int I forgot to reformat the print!
printf("[Clauses] %d - [obj best] %d = [fitness] %d \n", sat_clauses, (int)objective_best,...
Yea, I noticed that, but the actual value of both "objective_best" is the same, and should be (in this case) 297.0. Not sure why when I cast it to int it suddenly becomes this tiny number in the...
I am doing that in the second print attempt:
sat_clauses-(int)objective_best
*sigh* this has to be super simple, but I think my brain if getting fried from coding today.
I have an int and a double...i know the double is actually an integer value (in this case, but I cannot...
Yea, they are of different lengths. I thought there might be a 'cleaner' way to determine the size of it, but it looks like a separate array it is :) Thanks!
So, I'm clearly not understanding something, but I can't seem to be able to determine the length of my array. I have a
int **sat_data array, which is a set length array (i know that length) of...
Thank you guys!
Yea, the counting of spaces (token separators) is not very expensive, and probably just as efficient as the Java equivalent (StringTokenizer) - i just need to get used to the fact...
Thank you Adak, your solution is quite clever, but I did oversimplify the problem a bit, and while the space delimiter is always there, I cannot assume the length of the token, so the little math...
Lets say I'm reading in a file:
a b c d
e f
g h i
I go through it line by line, getting a string line = "a b c d", "e f", "g h i" respectively per every fgets().
If I know the amount of...
Update:
Well, I realized I can just count the spaces and that number+1 is my amount of tokens...better then re-tokenizing it twice, but still seems ugly.
Hey guys,
I'm trying to convert a big chunk of Java code into C, and ran into a little problem with a part of it (been a while since I touched C).
I'm trying to tokenize a string, for example...