Questions tagged [general]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
449 views

PHP removal from CS50

Hello dear CS50 folks, I was wondering - just out of curiosity - why PHP was removed from CS50 ? And why choose Python instead ? If someone could give me an elaborate answer, explaining the ...
0
votes
2answers
148 views

C data types and format specifiers

I was playing around with data types and format specifiers. Compiling the first snippet of code gives no errors but when I try to use unsigned shorts (or shorts in general) I get an error on line 12: ...
2
votes
2answers
971 views

What will realloc() do if the contiguous memory location is already occupied?

Consider- char* name1 = malloc(4 * sizeof(char)); name1 = "Mike"; Now if i want to put "Mike Smith" in the same string "name1", I need 6 more bytes of memory (one for the space and 5 for "Smith". ...
1
vote
1answer
1k views

When we free a dynamically allocated memory, what happens to the pointer pointing at it?

After watching section on "Dynamically allocated memory" (from Week 4) several times, I still have a question unanswered. Consider the following code- // Allocates 4 bytes of memory on heap and ...
1
vote
1answer
641 views

Memory allocation: recommended practices

I'm rambling a little with hacker 2 (the passwords') and, in the meantime, gained some insight about pointers, mem-alloc, 'valgrind', etc... It's been a truly great, challenging experience. But, ...
0
votes
1answer
212 views

Conceptualising resizing in pset5

I've just solved the resizing part of pset5 without completely understanding what is happening during the reading of the infile and writing of the outfile bit. To clarify my question, here is my code ...
2
votes
3answers
187 views

CS50 FAQ's and answers [closed]

I've created this post so that all the FAQ's and their answers can be collected here, in order to prevent re answering the same questions over and over again, be sure to check the answers to this ...