Skip to main content
6 votes

Understanding how memory is allocated in driver code PSET 4, Filter (Less Comfortable)?

RGBTRIPLE(*image)[width] means variable image is a pointer to an array of length width of RGBTRIPLE. RGBTRIPLE *image[width] means variable image is an array of width pointers to RGBTRIPLE. The ...
Blauelf's user avatar
  • 21k
3 votes
Accepted

Why can't I print the entire string from the read file?

I guess you meant print(dna[i:i+len("AGATC")]). In Python, if the end of the substring is before the beginning, the substring is empty, so you are printing a bunch of empty strings.
Blauelf's user avatar
  • 21k
3 votes
Accepted

python invalid syntax end=""

I added a space in there and it took the flag away. The rest of the print lines without the space are not flag. I'm wondering if this is a bug with the IDE or am I not understanding something? This ...
Adam's user avatar
  • 41
2 votes

Understanding how memory is allocated in driver code PSET 4, Filter (Less Comfortable)?

What are the parentheses doing? As Blauelf explained, they are changing order of operations. I didn't full grasp why this was needed though until trying to compile without them. filter.c:78:15: ...
drl's user avatar
  • 81
2 votes

MARIO LESS COMFORTABLE

Using the 5 pyramid as a guide: Height: 5          ##        ###      ####  &...
DinoCoderSaurus's user avatar
1 vote
Accepted

Pset4 filter-less -- "function definition is not allowed here"

It's a simple error, there's a missing closing curly brace before the start of the minimum() function. This is commonly the problem when you get this error. It's telling you that you can't define a ...
Cliff B's user avatar
  • 69.3k
1 vote

Why is my code not compiling (simple get_int example)?

So in fact you didn't copy his code, you tried retyping it and made errors in the translation. Let's straighten up some terminology: parenthesis = ( and ) braces = { and } brackets = [ and ] For ...
UpAndAdam's user avatar
  • 1,681
1 vote

Could someone explain to me how curly braces work?

Curly braces help define scopes (range of allowed operation) for variables and statements in C and some other languages. They also help in defining coding styles. The CS50 course uses a particular ...
EddyBeor's user avatar
1 vote

Syntax Highlighting Error

Just a guess, did you open a new file that has yet to be named or saved? Assuming you're in the CS50 IDE, are you writing your code in a file with the .c extension? The IDE has to see that extension ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

cs50 pset7 buy syntax error

I would expect you to have an autoincrementing id field that is the primary key (so each transaction has an id) and then a user_id field that holds the user_id for the transaction (that is not unique)....
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

PSET 6: Caesar.py - stuck on "SyntaxError: invalid syntax"

It is as easy as replacing else with elif, in python a condition is not allowed after an else, remember that else is executed if the if condition is not fulfilled, if we want to impose a new condition ...
MARS's user avatar
  • 5,179

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