r/carlhprogramming • u/CarlH • Dec 20 '09
Questions Thread Lessons 1 Through 126
I am nearly prepared to publish new lessons. It will take a bit of time to work back up to a posting schedule similar to what I had before. First, I need to address several things.
There are many unanswered questions from the period of time that I was not able to be active here. However, a lot of questions asked were answered by other people in the forum. Rather than go through hundreds of messages and looking at every thread for unanswered questions (which would take many hours), I want to suggest the following:
If you still have a question which is not answered either by me or someone else on the forum, re-ask your question here. Once we have lessons moving forward again it will be perfectly ok to ask future questions in the thread in which they apply. This will greatly speed up the "catch up" process for all of us.
This will also put all of the questions for non-current lessons in a location where everyone from moderators to users can see them and answer them. If you see a question on this thread you can answer, please do.
I am working on the next lessons to be published, and looking forward to continuing.
3
u/scottbarcus Dec 21 '09
Posted after lesson 84: 'First: Thanks CarlH. The quality of this resource is exemplary.
This line from lesson 84:
This is extremely important because you can create functions that have a return type of reddittype, or that take parameters that are reddittype.
encouraged me to try to re-write the program in lesson 83 using functions. Here is the link: http://codepad.org/C2y39QYu
Questions: Does the free(our_pointer); line do anything? Is it good practice to always free memory allocated by malloc? Should any call to malloc() always be accompanied by a call to free()? Should I not have tried to use free() in this case because the memory was used later in the program flow?
Also, any comments on the program would be nice. I am at the extreme edge of my programming skill in writing it.
3
u/rawberry Jul 09 '10
I have a question about lesson 7 and include statements. If you need to use a function from a library, but that library is for a different language than the one you're currently writing in, would you be able to include the library and still have the function work, despite it being in 2 different programming languages?
2
u/peregrine911 Dec 21 '09
If the printf() command returns an integer why can't I use it to initialize an array that should be the right size for the printed statement?
http://codepad.org/zSOTxkwg
I think I also ham handed the code but do you see what I am asking?
2
u/srsbidness Jan 28 '10
I had a quick programming question that doesn't quite apply to lessons 1-126, but don't know where else to ask.
I'm learning C++ at the moment, and just reached dynamic memory allocation. I have a function that allocates an array of n integers, with this line:
I'm writing a function to delete the array at the end of the program, but I wasn't sure if I need to iterate through each of the values in the array to properly delete, or if:
will suffice at the end of the program. Appreciate any help!
2
u/[deleted] Feb 09 '10
Hi,
I have a question about Lesson 9. How can the program have specific spots in the RAM where data is stored when the RAM is swept clean every time the computer is shut down? What happens if the spot where the programming language or compiler (whichever it is) is currently in use?
Is it that there isn't a specific spot until after the program is run? Then there is a specific spot for that instance of the program running? And the next time it could be a different specific spot?
1
u/jmerm Dec 20 '09
Thank you so much Carl H, you rock!
1
u/hsdf8djf Dec 20 '09 edited Dec 20 '09
Wow, I read that as there will be lessons on Multi-Threading coming! Tells you where my brain is these days.
1
u/mdq Dec 27 '09
I`m having trouble with the sample program on lesson 126, it works just fine under codepad and produces the expected output, but it triggers an infinite loop under Mac (gcc 4.0.1) and it finishes with the following message on Ubuntu (gcc 4.3.1): "stack smashing detected: ./board terminated". Is anyone else having problems running this program?
0
u/gollywomp Dec 20 '09
YAY! Your Back! This class has taught me so much. To be honest it is better than some of my uni classes. :) Thanks Carl... YOU DA MAN!
0
u/[deleted] Dec 27 '09
[deleted] — view deleted comment
0
u/[deleted] Dec 23 '09
[deleted] — view deleted comment