Skip to main content
3 votes
Accepted

Pset4 recover, comparing hex in if statements

@Blauelf is correct: you can't count on char to be an unsigned 8-bit int. However, you can use a typedef to make certain that a BYTE is really a byte. Look at these type definitions, borrowed from ...
hotwebmatter's user avatar
  • 3,050
2 votes

Pset4 recover, comparing hex in if statements

char can be signed or unsigned by default (and is 8-bit on every system I know, but that's not guaranteed by the specs). On this system, char datatype is signed 8-bit int, ranging from -128 to 127, ...
Blauelf's user avatar
  • 21k
2 votes
Accepted

What is the return value when isalpha() evaluates to true?

The problem is a lack of understanding of how many of these functions work. While you would think that isalpha() would return a bool, it doesn't. Instead, it returns a number. If it is false, it ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Are boolean variables left uninitialized true or false?

There is no default value initialization guarantee of any kind in C. I don't know where you learned the default value of booleans is false but I strongly question that information and disagree with it....
UpAndAdam's user avatar
  • 1,681
1 vote
Accepted

Do computers have to check if (false) the same way as whether (0 != 0), etc.?

Interesting question. The computer has to evaluate whatever is in the parentheses. The more complicated, the more it has to process. If there is only a variable inside the parentheses, then the ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Week 2 Lecture - Functions - Valid Triangle

Just like the function printf, the valid_triangle function has to be called from within main in order to execute and produce results.
DinoCoderSaurus's user avatar
1 vote

Else If Boolean Statements of Equality In the Case of Complex Numbers

That example doesn't say what data type x and y are, but generally you can assume that numerical variables are real numbers in programming, unless specified otherwise. There is a way to work with ...
Llenk's user avatar
  • 744
1 vote
Accepted

What's in the bool function parenthesis?

No such thing as a silly question. It just means that you haven't learned it yet. That's all. ;-) This is a function "signature". It defines what is expected to be passed to the function. int rank ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

Pset3 is_rest does not compile right?

You get this error because it is possible to get to the end of the function without giving a value to return. Specifically, there's only the one return statement in the code. If value is not 0, then ...
Cliff B's user avatar
  • 69.3k
1 vote

Pset4 recover.c compiles, but can't seem to print Jpgs at all

I tried to isolate some of the codes in modular form and created a file just to check this code. It seem to be the problem. Did I declare the function within the if statement wrongly? #include <...
olafironfoot's user avatar
1 vote
Accepted

Pset4 recover.c compiles, but can't seem to print Jpgs at all

Just to be crystal clear: if (data[3] != 0xe0 || data[3] != 0xe0 || data[3] != 0xe1 || data[3] != 0xe2 || data[3] != 0xe3 || data[3] != 0xe4 || data[3] != 0xe5 || data[3] != 0xe6 || data[3] != 0xe7 ||...
hotwebmatter's user avatar
  • 3,050

Only top scored, non community-wiki answers of a minimum length are eligible