And for the record, he was right. Your code shouldn't even run, by modern C standards. You literally got lucky with memory addressing.
Type: Posts; User: FrankTheKneeMan
And for the record, he was right. Your code shouldn't even run, by modern C standards. You literally got lucky with memory addressing.
I have no idea if Salazar is even reading this thread any more (I somewhat doubt it), but just in case
Because that's what you programmed it to do? I don't really have any idea how your compiler...
Too true. If you really need to pass something "by reference", then you should have a function that expects a pointer, rather than a value. (in the case of altering pointers, then you should expect...
Found it. I wasn't unlocking the right mutex - I'm using an array of mutexes to lock individual buffer slots, and I was incrementing the array variable, and thus it attempted to unlock the next...
Also, you should check out string formatting characters, and how to set limits on them.Wikipedia's prinf page is a good place to start.
Variable. I've been running it with only one, just to test functionality. Changed it to a broadcast, but it didn't seem to help. All the literature I've read says that once signaled, the thread...
Well, I've pumped the code full of those diagnostic print statements, and the output goes something like this:
Indicating that the consumer thread is hanging on the pthread_cond_wait(); I'll...
The way I would do it is:
for each guessed
for each actual
if guessed=actual
continue;
if board[guessed]=board[actual]
correct num++;
...
Does this even compile? Seems unlikely...
Start by correctly defining your functions:
return_type func_name(arg_type arg, ...){
// do stuff
}
makes a function named func_name, which takes arguments arg (of type arg_type), and...
struct tnode *treeread(struct tnode *p) {/*here it gets stuck in loop*/ if (p!=NULL) {
treeread(p->left);
treeread(p->right);
return p;
}
}
I'm surprised your compiler didn't warn you...
Hm... Lots to say here...
It looks like you're trying to read in a string and change all the spaces to underscores. First of all, gets() is a dangerous function. Everyone around here will...
Been searching these threads on and off for a year or two. Only started posting a week or so ago. Thanks for the welcome.
Sorry to hijack your thread there, damha - did you figure it out or do...
I appreciate errors, and lord knows I make my fair share of them, but I was serious. Judging from the language, damha is in a class - likely an "Intro to C" how "C programming skills" class. ...
Having a little problem with a threaded producer/consumer application - one producer, multiple consumers.
producer(){
for (i=9; i<argc; i++){
//handle files
input = fopen(argv[i], "r");...
Yo, simmer. If you read the man page for gets it will point that out, and point you to fgets. This is clearly a class/learning type situation here. A little headache now will lead to a better...
Well, if you're starting at 1, then you could always make your loop condition (i && (i<max || ignoremax)), then once you've lost count, and looping is unnecessary anyway, you could break from the...
The question is asking you to basically do the following:
Read in a line of input.
--- check out the man page for 'gets'
Check to see whether it contains all of the vowels.
Print a statement...
Thanks, anduril, I ought have been checking my returns. Or, moreover, just been using good coding practices in general.
Turns out, earlier in my code for the client I had sent a string I declared...
It less uses states as it does co-opt the fact that the board is represented as a char[5] to send easily identifiable messages. "Win.", "Lose", "Err.", etc, which the client recognizes and has...
I'm writing a pretty trivial game server, and am having some trouble with my sockets and the dataflow therein. I have in my server the following code:
for(i=0;;i= (i+1)%2){
send(p[i], board,...