# Search:

Type: Posts; User: oogabooga

Page 1 of 20 1

1. ## Thread: First post. Confused about Boolean

by oogabooga
Replies
12
Views
623

### I didn't realize you were so fragile. You sure...

I didn't realize you were so fragile.
You sure like name-calling, though.
2. ## Thread: First post. Confused about Boolean

by oogabooga
Replies
12
Views
623

### && yields 1 if and only if both it's operands are...

&& yields 1 if and only if both it's operands are non-zero; otherwise it yields 0.

|| yields 0 if and only if both of it's operands are 0; otherwise it yields 1.
3. ## Thread: First post. Confused about Boolean

by oogabooga
Replies
12
Views
623

### Are you some kind of paranoid associativity...

Are you some kind of paranoid associativity fanboy? I think you mean precedence.
4. ## Thread: First post. Confused about Boolean

by oogabooga
Replies
12
Views
623

### You need to consider the precedence and the...

You need to consider the precedence and the parentheses. The part in the parens is computed first.
Within the parens, the && has higher precedence, so the first thing that's computed is 1 && 0,...
5. ## Thread: Beginner GPIO Question

by oogabooga
Replies
3
Views
622

### Firstly, remember that the equality operator is...

Firstly, remember that the equality operator is ==, not just =. You need to change this in your if conditions.

Even with this change it's difficult to understand what your code is trying to do....
6. ## Thread: bit masking and serial programming

by oogabooga
Replies
4
Views
1,112

### You're not "assigning" it that value. You're...

You're not "assigning" it that value. You're "anding" that value with it's current value. CSIZE is a mask with 1's in the position of the bits that encode the characters size. By complementing that...
7. ## Thread: error in displaying linked list after deletion from middle-please spot it and tell me

by oogabooga
Replies
3
Views
744

### 1. Declare main as int main(void), not void...

1.
Declare main as int main(void), not void main() (which is not a standard declaration and yields no benefit). And put a return 0 statement at the end of main.

2.
Remove the fflush(stdin) calls...
8. ## Thread: Understanding Strings

by oogabooga
Replies
7
Views
669

### C99 has the z length modifier for the size_t...

C99 has the z length modifier for the size_t type.

printf("%zu", strlen(str));
9. ## Thread: theoretical question about c programming

by oogabooga
Replies
25
Views
2,058

### Without threads the program simply rotates around...

Without threads the program simply rotates around the various tasks, performing a little of each at a time, and it does it so quickly it looks like they're all happening at the same time.

However,...
10. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### @Soma, I agree with pretty much all you said,...

@Soma,

I agree with pretty much all you said, though to ask what fflush(stdin) does is not relevant since it is presumably documented by MS. I don't know and I don't care because I've never used...
11. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### @Soma: How can a If it's undefined, it's...

@Soma:

How can a

If it's undefined, it's undefined. Undefined means that the implementation is able to do absolutely anything it wants to. It's under no obligation to trash memory, erase the...
12. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### I don't feel you're being harsh or trying to...

I don't feel you're being harsh or trying to start anything. :) I'm interested in this discussion and I know that I have it at least partly wrong.

I've been reading the standard lately and am...
13. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### I did "warn him off" by telling him it was...

I did "warn him off" by telling him it was non-portable.
"Undefined behavior" is a portability issue. That was my point.
I don't recall "teaching" (or using) fflush(stdin).

I realize that...
14. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### "Undefined behavior" simply means that the...

"Undefined behavior" simply means that the standard does not define a behavior for it. That's all. Any particular implementation is free to define a behavior for it and still perfectly conform to the...
15. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### To protect against such buffer overflows you can...

To protect against such buffer overflows you can use fgets to read the file a line at a time. This function puts a limit on how much it reads, so it won't overflow the buffer. Since you have to pick...
16. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### You should include ctype.h (for isalpha and...

You should include ctype.h (for isalpha and isdigit).

You should use getchar (instead of the non-standard getch).

spac is "unused" (and doesn't have enough space to hold a string with a single...
17. ## Thread: character array filling with junk

by oogabooga
Replies
29
Views
3,343

### You talk about reading and writing to files as if...

You talk about reading and writing to files as if that can't possibly affect any other variables. But if one of those reads overflows a buffer, that data can run into the other variables' memory.
...
18. ## Thread: Langton's ant issue

by oogabooga
Replies
10
Views
3,371

### Putting your code together with my changes and...

Putting your code together with my changes and entering 20 and 100 yields:

+--------------------+
| |
| |
| |
| |...
19. ## Thread: Langton's ant issue

by oogabooga
Replies
10
Views
3,371

### You're running your function twice for each...

You're running your function twice for each iteration.
Try this (untested) :

for(int i = 0; i < anzSchritte; i++){
if((nextStep(insectZeiger, laenge, raster)) == 3){
...
20. ## Thread: Langton's ant issue

by oogabooga
Replies
10
Views
3,371

### You have duplicate code. And you could use a...

You have duplicate code. And you could use a switch.

int nextStep(struct Ameise* ant, int len, char antarena[][len]){
switch (antarena[ant->y][ant->x]) {
case ' ':
...
21. ## Thread: Programming software for my job

by oogabooga
Replies
35
Views
2,276

### That's not what I grow. And it sounds like you...

That's not what I grow. And it sounds like you might have been smoking a little of your imaginary "synthetic" marijuana.

Naaaaah, I'm just yankin' yer chain!
G'nite.
22. ## Thread: Programming software for my job

by oogabooga
Replies
35
Views
2,276

### I'm glad you're getting all the evil mariHuana...

I'm glad you're getting all the evil mariHuana people off the streets.
I feel so much safer.
23. ## Thread: Programming software for my job

by oogabooga
Replies
35
Views
2,276

### I don't find marijuana offensive.

I don't find marijuana offensive.
24. ## Thread: Using free for DLL Structure

by oogabooga
Replies
8
Views
644

### Another common (and probably better) alternative...

Another common (and probably better) alternative is to have a separate List struct:

typedef struct List {
DLLNode *tail;
size_t size;
} List;

You'd initialize...
25. ## Thread: Using free for DLL Structure

by oogabooga
Replies
8
Views
644

### Please post code that compiles, which means...

Please post code that compiles, which means including all headers.
Even adding headers, you still have an error (DLLNode does not have a member called i).
And since you're compiling with -g,...
Results 1 to 25 of 500
Page 1 of 20 1