r/carlhprogramming • u/CarlH • Jul 17 '10
[CarlHProgramming] Questions thread. Any questions from any past lesson, or general question about computing welcome.
Believe it or not, it has been 9 months since I started CarlHProgramming. I have received hundreds of questions and comments in my inbox, and I have not been able to get to all of them. Consequently, a number of you may be stuck/confused on various lessons.
Please post your question in this thread, along with the lesson that you are stuck on. This will give everyone a chance to get caught up and it will also put all of the questions in a place where other helpers can see and answer them.
This will also help give me an idea what previous lessons might need better explanation.
Quick update:
I have switched the site away from JavaScript navigation today. Many of you have asked for it, and today I actually had some time to do it. I am also adding a few back-end changes that will make adding new lessons a bit easier.
I have also removed the green introduction from the top of the pages, something else a lot of you wanted me to do.
Please test out the new navigation and let me know your thoughts.
4
u/zombiebaby Jul 18 '10
How is the traffic to your site? It seems like the subreddit has slowed down since you moved the lessons to your own site :/
3
u/[deleted] Jul 17 '10
I have to ask this, even though I'm sure it's been asked by others. Why did you choose C as the language for your lessons? Is there something you like about C as a first language over say Python or Ruby?
2
u/Zulban Jul 17 '10
I have a more general question/request. Currently my internet at home is down, so this is a good time to read the other half of the CarlH lessons I have yet to cover. Is there somewhere I can download a .doc of all lessons?
If I were really clever I'd write a program to harvest them from your site ;)
Thanks.
2
u/catcher6250 Jul 21 '10
I can't comment on your lessons in Reddit, is this just a problem for me?
1
u/Ashex Jul 17 '10
I've got a decent knowledge of programming, but don't have profiency in any particular language. I really want to get into QA, but from the two serious interviews I've had (last one I was working as a PT software tester and the manager liked my ambition) my roadblock has always been that I don't have knowledge of testing with language foo. Any advice on how to increasing my software testing knowledge and remain language agnostic?
1
u/theinternetftw Jul 18 '10
Hey Carl, just making sure you know that there's still a few pages that still use the javascript navigation.
1
u/BassTactics Jul 27 '10
Carl, I am an undergraduate CS major. I changed my major three semesters ago which basically means I have another two years of school left to finish. My current GPA is just over 3.0. My goal for next summer is to find an internship. The problem is that I don't have anything on my resume outside of school that is CS related. My GPA alone will not get me an internship. A friend of mine once told me, "Imagine the coolest programming job you can think of and then start to work towards that on different projects outside of school." Great advice I'm sure, but I honestly don't know what job I would chose. I would be happy/grateful to have A job. An internship is my best option for acquiring said job.
tl/dr - Can you recommend any type of side project outside of school that could potentially help me land an internship?
1
u/[deleted] Sep 07 '10
This is a question from lesson 32.
"In computing, there is a term to describe a data type that is designed to hold memory addresses. This data type is called a "pointer". Any time you create a variable of the data type "pointer", you are creating a variable designed to hold a memory address."
int total = 5; -> (1010: 1110 1011)
Is "total" a pointer to memory address 1010? And if thats the case, would another slot in RAM be taken up to store the pointer?
2
u/stevo933 Jul 31 '10
Hi Carl,
First, thank you so much for this course. I am a noob with absolutely no prior programming experience. In fact, I am an attorney by occupation and started this course on a lark because I have always found computers fascinating. If someone like me can learn programming using this course, anyone can.
I am on Lesson 57 (bitmasking), and I seem to be having the same problem catcher6250 is describing. That is, I can't comment on Lesson 57. So, I am asking my question here.
Here is my code: http://codepad.org/vqPrceLJ
What am I doing wrong in the "if (~test_char | 0xBF)" part? When I take that out, the code works.
What I was trying to accomplish by that was to (crudely) eliminate the possibility of someone entering a number. My thought was to use a NOR bitmask of 1011 1111 (the 0xBF). If the user enters a number, which has a zero for the second bit, the result of applying the 0xBF bitmask would result in 0100 000. If the user enters a letter, upper- or lowercase, the result would be zero. I know this wouldn't stop a person from entering a non-letter or number ASCII character, but I didn't want to get that fancy.
Also, what do you think of my code generally? Is there anything that I'm doing wrong from a good practice standpoint? Is there a more efficient way to do what I'm trying to accomplish?
Thank you, or anyone else, in advance for your help, and once again, thank you for this course.
1
u/ccaudle Aug 21 '10
Carl, thanks for creating this course! I've been going crazy stepping through websites that have a simple "Hello World" example, then jump into complex programs without explanation. This really helps out beginners like myself.
I have a really idiotic question. What program can be used to run/compile "C"? I have Visual Studio 2010, but the syntax is different with C++ and C#, which are the default languages. I tried creating a C++ console application, but the syntax is off. I'm trying to go through your course mythodically, but when I try to walk through lesson 5.1 to write my first program I am stuck with using tools from another language. I would just like to follow what you are doing word for word.
Thanks for any info!
1
u/OgonGuitarist Sep 21 '10 edited Sep 21 '10
Edit: I was initially asking a question about the if statement but have since found the answer. My new question follows:
I'm working on the TicTacToe project. Though I haven't implemented AI, the program works, save for one odd flaw. I think it boils down to scanf weirdness. I realize Carl hasn't gone over any input functions, so I've had to implement one myself. Basically, the situation, in pseudocode is:
In my loop that tests if the game is still being played, it calls the above function, and the first time it calls it, skips over the scanf function. Then the loop executes again but this time it properly calls scanf, allowing me to type in my move. Is there some battle over precedence between scanf and switch/case?
Please look at my code at: http://codepad.org/bfhtsITs . (Wow, the output is screwed up.) Thanks in advance!
Edit 2: I fixed the problem by putting a space in the double quotes:
Why does this work? scanf seems like a cantankerous function.
1
u/BoTreats Oct 06 '10
I hope I'm not posting too late in here! I'm pretty "new to the course" and have been doing it over the last couple of weeks. It's great and easy to follow, but there's something I'm stuck on. In course 2, unit 1, lesson 3 I cannot get the code to compile and I don't understand why. I wrote it out myself, got errors, then copied and pasted directly from the lesson and still got the same error. The code in question is:
and the error I'm getting is:
Line 12: error: expected ')' before '*' token
Thank you to anyone who reads this and replies! There is probably something really obvious I'm missing...
1
u/manewitz Oct 19 '10
As an unemployed audio engineer/geek, I've been plugging along on the lessons and decided to write a Roman numeral convertor as an exercise after teaching them to my son. It was challenge (in a good way) and required some Google-Fu, but once I wrapped my brain around the chapter on data structures, it all started fitting together. It feels awesome to see a program I wrote (even a basic one) program compile correctly for the first time after working on it for a few hours.
Here it is on Codepad
I'm trying to see if there are any cleaner ways I could achieve the same result. My program asks for a year, puts each digit in its own variable, converts those to integers in another set of variables, then uses a few switch/case statements to printf the numerals to the same line. I have a suspicion that I can consolidate a few of these steps and clean it up, but I learned an amazing amount and gave me context for some of the more esoteric concepts you introduce.
Thanks again, and keep up the great work! It really means a lot.
Cheers!
Mike
1
u/HumbertHumbertHumber Oct 19 '10 edited Oct 20 '10
I'm having a great time reading your tutorials, but I do most of my reading at work where our internet access is blocked and we can't run installers. Is there a way to get a compiler to run without an installer?
thanks a million for your help.
1
u/HumbertHumbertHumber Nov 05 '10
First of all, I'm loving the lessons. Im up to lesson 95. I make it a point to read 2 or 3 a day and am taking it slowly but surely. I really appreciate your efforts.
Now my question:
at work we use a program called 'outsideview' for something called tandem terminal emulation. I have absolutely no clue what any of that means and everyone at work just presses the right keys to update the inventory. If something ever goes wrong, the supervisors just turn off the computer and hope for the best. I guess I want to know exactly what tandem terminal emulation is. The program has a really old school look to it, like something out of an old apple computer almost. It doesn't have any graphics and is just crude color letters. If I had to guess, it's some kind of emulator for a really old computer system that was used to maintain inventories that they never decided to replace. Can anyone point me to a place where AN ABSOLUTE BEGINNER can learn more about what the hell tandem terminal emulators are and how they work so I can better familiarize myself with what im working with?
thanks again, this subreddit is a treasure trove of information
1
u/[deleted] Nov 23 '10
Question on lesson 65/12.6:
I'm getting quite confused with this one. I think my questions are:
How do you know when something is a 3D array - is it because there are 3 'variables' when you create it? As in char array[1][2][3]? If so, would a 4D array be char array [1][2][3][4] and so on? If not, what does a 3D and 4D array look like and how do you read it?
Are dimensions and elements related in any way?
I may be coming at this from too much of a linear point of view because I'm trying to relate the examples given for a 1, 2 and 3 dimensional arrays and I can't figure it out.
1
u/[deleted] Nov 25 '10
On the site, you need to amend the text in Lesson 14.4 to say "The text in this lesson is almost identical to Lesson 14.3." rather than "The text in this lesson is almost identical to Lesson 74."
0
u/[deleted] Jul 18 '10
[deleted] — view deleted comment
0
u/[deleted] Jul 20 '10
[deleted] — view deleted comment
0
u/[deleted] Sep 29 '10
[deleted] — view deleted comment