Hot answers tagged

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 ...
  • 3,046
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, ...
  • 20.8k
2 votes
Accepted

PSET8 - MASHUP : Can't find FULLTEXT indexes when using WITH QUERY EXPANSION

It is very weird but I advice you to follow these steps: Use ALTER TABLE <table> ENABLE KEYS to make sure that your keys are active. If nothing's still working, use ALTER TABLE <table> ...
  • 155
2 votes

code doesn'work, please help

You seem to have made quite a few mistakes in your code. This is of course not unusual for someone who's just starting out, so let me point you in the right direction. You are reading the first reply ...
  • 332
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 ...
  • 66.7k
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 ...
  • 66.7k
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.
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 ...
  • 734
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 ...
  • 66.7k
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 ...
  • 66.7k
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 <...
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 ||...
  • 3,046
1 vote

pset2 caeser boolean returns

if (isdigit('k')) 'k' refers to the character or letter k, note that atoi converts the character of the command line to an integer, surely you want to do if (isdigit(argv[1]) however this is not ...
  • 5,201
1 vote
Accepted

A question about boolean expressions

Yes there is, a couple ways actually. These all work the same way: if ( !boolean ) do... if ( boolean == false ) do... if ( boolean ) not here.. else do... I hope this helps.
  • 122

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