3

Short answer: yes! Long answer: looking at the code of GetString() string GetString(void) { // growable buffer for chars string buffer = NULL; // capacity of buffer unsigned int capacity = 0; // number of chars actually in buffer unsigned int n = 0; // character read or EOF int c; // iteratively get chars from ...


3

Pay attention to the end of the video, where Prof. Malan explains the purpose of user-defined functions: ... as our programs get much more complicated, and our programs more sophisticated, this technique of ... decomposing your program into smaller functions, each of which call other functions, is a very compelling technique because it will ensure that ...


3

So what actually this condition does? this condition basically tests whether the char pointer (aka a string) s points to nothing (i.e., address 0x0 in the computer's memory) which is the address of a special location in memory that we can't read from/write to it. You'll know more about NULL, strings and pointers as you reach week 4. For now, take for ...


2

Actually, it's not really anything to do with the code you've typed in. Its the clang compiler complaining. The breakout.c program would also suffer the same fate if clang was not told to suppress the error in the Makefile definition file. For breakout it contains the following option: -Wno-unused-variable -W is the command line option relating to a ...


2

Absolutely - of course! If you're kind of new to CS you'll realise why very quickly. You'll also find technical help (only) here and technical, practical and moral support help on the CS50 Facebook page and CS50 Slack at http://cs50x.slack.com/ Request an invite to Slack at http://cs50.edx.org/slack - and find all this info and other social media ...


2

You are in the wrong directory, change the directory to where your file is stored i.e. Desktop here jharvard@appliance (~) : cd ~/Desktop jharvard@appliance (~) : make f2c jharvard@appliance (~) : ./f2c


2

If you're using edx, the videos posted on there have subtitles. Go to Week 0 > Shorts (or click here) and click one of the options on the top bar. I don't see the fourth video listed, however. Found a walkthrough (may be different, though) by browsing the files where the others were posted. You can find the download links for the videos here. You can ...


1

Here's the GetString documentation that David is referencing in that lecture, from the CS50 library 3.0: /* * Reads a line of text from standard input and returns it as a * string (char *), sans trailing newline character. (Ergo, if * user inputs only "\n", returns "" not NULL.) Returns NULL * upon error or no input whatsoever (i.e., just EOF). ...


1

Hmmm.... I disagree with the other answer, at least somewhat. Multithreading is when a single program actually runs more than one process in parallel. That program is actually written with multiple parallel threads in the code that can be executed in parallel, as opposed to standard linear programming. Further, they must execute in an environment capable ...


1

According to SPL's documentation about GTextField GTextField GTextField(int nChars); Creates a text field capable of holding nChars characters. Assigning an action command to the text field causes it to generate an action event whenever the user types the ENTER key. Usage: field = newGTextField(nChars); typedef GInteractor ...


1

The if/else if/else conditions are used in the following way: Single condition if (condition) { // code to execute } Double condition if (condition) { // code to execute } else { // code to execute } Multiple condition if (condition) { // code to execute } else if (condition2) { // code to execute } else if (condition3) { // ...


1

else is your last resort kind of command its like if this then { do this } or else if this then { do that } and finally when you cant think of any other condition you say you know what MR Computer if none of the conditions are met. else just do this you said else and then gave a condition. So the computer is yelling at you that " First you said you ...


1

The short version is that you shouldn't expect an executable compiled for one version of Linux to work on another. The simple explanation is that because of all the variations between all the different types and releases of Linux, the only way that an executable is likely to run is if it was compiled with the same version of the same release of the operating ...


1

When you issue the command make bounce in a terminal window, it will usually do one of two things - it will either try to make the executable file 'bounce' from the source file 'bounce.c' or it will tell you that it is up to date. If it says that it is up to date, it means that the source file, 'bounce.c' hasn't been changed since the last time you built the ...


1

I took this off the video and it worked for me: clang -ggdb3 -Ispl/include -O0 -std=c99 -o bounce bounce.c -Lspl/lib -lcs -lm Note the bits about spl after -ggdb3 and before -lcs.


1

Figured it out. sizeof gives the size in bytes. simple fix: sizeof(arr)/sizeof(arr[0]) gives the number of elements in the array.


1

Remember that parameters in function call should pass the address of variables like swap(&p, &q); Ideone int tmp = *a; The value stored at the memory block to which a was pointing, is being stored in tmp *a = *b; The pointer a is made to point to where the pointer b was pointing initially. Till now, *a holds the value of pointed by b, *b retains ...


1

All the course resources can be found on the course's website and the Youtube channel too! Here's cough-1 from week 0!


1

Computer science is all about problem solving. And there are usually many solutions to a single problem. Yes we could have used a single custom block, passed "cough" or "sneeze" and the number of repeats when calling it and used a loop within the function to repeat that, but for an approach being better or worse than another, this depends on many things. ...


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