kzidane
Moderator
  • Member for 7 years, 6 months
  • Last seen more than a month ago
2 answers
vote
4k views
How to jump to a specific line in gdb
1 votes

I would break the line that I want to jump to and continue. Watch the short on gdb for more info!

View answer
2 answers
votes
261 views
pset7 finance - centre align the nav bar
0 votes

CSS is often so confusing (even for me sometimes :D). You often have to try things out to understand what they actually do. For example, when you set the margin to auto, typically your un-ordered ...

View answer
1 answers
votes
30 views
don't understand this code
1 votes

can't figure out the j=j*k expressions The expression j = j * k means multiply the value that is currently stored in j by the value stored in k and store the result back in j. when we say return j ...

View answer
2 answers
vote
3k views
How to interpret biHeight data
3 votes

From MSDN, biHeight The height of the bitmap, in pixels. If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, the bitmap is a ...

View answer
1 answers
vote
545 views
fseek in pset4(whodunit)
Accepted answer
2 votes

Given that padding cannot be read by fread Who says the padding can't be read by fread? Of course it can and that's the main reason you need to skip it — in order to make fread read the first pixel ...

View answer
1 answers
vote
285 views
Initials program results in "Segmentation fault(core dump)?
1 votes

You initialized the string initials with a string literal. String literals are constant — once they are created, you cannot change their values. To fix that, you should use a char array instead.

View answer
2 answers
votes
521 views
How are file data stored in an int buffer?
Accepted answer
1 votes

It can't be bfType = 0x424d because that is a completely different number. Yes, it would surely be a different value if it was interpreted as a whole and compared it with each of the 0x42 and 0x4d ...

View answer
1 answers
vote
975 views
What do I get compilation errors when compiling bounce.c?
2 votes

You need to link the spl library using the -l option. Your compilation command should look like this clang -ggdb3 -O0 -std=c99 -Wall -Werror bounce.c -lcs50 -lcs -lm -o bounce If you want to use ...

View answer
1 answers
votes
83 views
segfaults and delayed printf commands while using GWindow in loop
0 votes

It doesn't really "skip" the printf statement. Instead, it just "buffers" the output (in this case, the string "we lived"), then "flushes" it at some point (e.g., when you print a newline). For more ...

View answer
1 answers
vote
1k views
How is mergesort a O(n log n)?
Accepted answer
1 votes

Merge sort consists of two main parts — diving part and merging part. In the dividing part, the n-element array gets divided into two halves, and the halves into halves, ... until you have n one-...

View answer
3 answers
votes
2k views
Are const Local Variables Implicitly static?
0 votes

It turns out I was just a bit confused and the two things are totally different, separate things that have nothing in common. I was confused as I read the following lines A static, local variable ...

View answer
4 answers
votes
290 views
My code keep creating infinite loop (Mario Pset1)
1 votes

Variables have something called scope. Watch the short on scope for more info! When you are defining a new variable with the same name as another variable that is in scope, you are practically ...

View answer
2 answers
vote
2k views
Checking the base address of pointer string
0 votes

A variable of a pointer type, like any other variable, has a memory address and may store a value. The thing is that the type of values that a pointer variable may store is also a memory address. ...

View answer
1 answers
votes
39 views
What does `typedef struct GWindowCDT* GWindow` mean?
Accepted answer
1 votes

The typedef keyword defines a type synonym for an existing type — it basically defines a new name for an existing type. The original type name and its type synonym can be interchangeably used in your ...

View answer
1 answers
votes
142 views
unable to use a 2d array via function
1 votes

A function that takes a 2D-array as an argument may have the following prototype void foo(int arr[][<cols>]); where <cols> is the number of columns in the array to be passed. For example ...

View answer
1 answers
votes
39 views
Touching event isn't going off, when sprites touch
0 votes

The problem is that the dragon touches the princess while it is gliding. So control never leaves the else block until the dragon finishes gliding. I'm not sure if this is the best solution, but I ...

View answer
1 answers
votes
466 views
Is it possible to code lookup function without malloc?
Accepted answer
2 votes

Well, here is the thing: I don't think you really have to allocate memory on the heap at all. Besides, you are never making use of the allocated memory and it is not recommended per the pset ...

View answer
1 answers
votes
446 views
Gedit is not working on CS50 Appliance
Accepted answer
3 votes

Try executing the following commands in the terminal sudo apt-get update sudo apt-get install --reinstall gedit the password is "crimson" if you are asked for one.

View answer
1 answers
votes
44 views
if I have a better code that does more things than the one asked for, should I submit which one?
Accepted answer
3 votes

In general, a good software engineering tip is to have your software doing exactly what it is supposed to do (no more and no less). This tip is enforced by check50. That is, if your program execution ...

View answer
2 answers
votes
946 views
Do we need to return 0 in C?
Accepted answer
2 votes

Typically and according to the standard, the return value of main should be of type int which obviously means that you should return an int value from main. However, you don't really have to do that ...

View answer
1 answers
votes
137k views
Why do I get the "invalid operands to binary expression" error?
Accepted answer
11 votes

The remainder operator (otherwise known as the modulo operator) % is a binary operator (i.e., takes exactly 2 operands) and operates only on integer types (e.g., short, int, long, long long, etc). It ...

View answer
1 answers
votes
17 views
How does the processor differentiate between two alphabets in binary?
Accepted answer
1 votes

A char variable/value is typically a single byte long on most systems and this size is basically the way that a computer uses to know where the data that represents a char begins and where it ends. So ...

View answer
1 answers
votes
56 views
Max value of an int variable
Accepted answer
1 votes

No, an int variable, whether it's signed or unsigned, cannot store values that are out-of-range and trying to assign a value that is out-of-range to an int variable would typically result in a warning ...

View answer
3 answers
vote
526 views
On-Screen keyboard
1 votes

I don't have access to appliance 2014, but since it's Ubuntu-based, you should have an application called Onboard under the applications. If you don't, you may install it by executing sudo apt-get ...

View answer
1 answers
votes
426 views
Binary search always return false
Accepted answer
1 votes

From the pset specification page You are welcome to take an iterative approach (as with a loop) or a recursive approach (wherein a function calls itself). If you pursue the latter, though, know ...

View answer
1 answers
vote
907 views
How to configure make to execute a specific compilation command?
Accepted answer
5 votes

Two ways to configure make to execute a specific compilation command with specific options are: Makefiles Environment Variables Assuming you have a source code file of a C program named prog.c, to ...

View answer
1 answers
vote
229 views
How can I avoid segfaults when sorting my linked list?
Accepted answer
2 votes

Regardless of whether the code does what it should do or not, the problem is likely to be caused by the fact that you are trying to access cursor->next when cursor is actually a null-pointer. This ...

View answer
2 answers
votes
3k views
code: string initial = toupper(name[0]); Getting an error
4 votes

The Truth Behind chars Characters are represented using numbers underneath the hood. Each character has a value known as an ASCII value. Learn more about ASCII values! A variable of type char is ...

View answer
2 answers
vote
374 views
Why do we not get a warning when passing a string where we should pass an int?
Accepted answer
2 votes

It turns out that isalpha is defined as a macro in the ctype.h header file, in my case, according to this answer (by @ouah on Stack Overflow): Add -Wsystem-headers to get the warning From gcc ...

View answer
1 answers
votes
1k views
(Hacker2) Why am I getting a seg fault here from fgets?
Accepted answer
1 votes

Not really. The cause of the error involves some topics that you will study later in the course. I'll try to simplify my answer as much as possible, but don't panic if you don't fully understand what ...

View answer
1
9 10
11
12 13
22