Hot answers tagged

4

Yes, when you use a free(px); call, it frees the memory that was malloc'd earlier and pointed to by px. The pointer itself, however, will continue to exist and will still have the same address. It will not automatically be changed to NULL or anything else. The only thing that will remove the pointer var from the stack would be if it went out of scope, just ...


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 ...


1

The var swaps is used to detect whether any swaps occur, not to control whether the code displayed on the screen is allowed to run. Here's how it works. You want to know if any swaps ever occur. At the beginning, you set int swaps = 0; because so far, there have been no swaps. If at the end, it is still 0, then it means that no swaps were made and the ...


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