• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Trying to learn C/C++... need a project

TheDude05

Limp Gawd
Joined
Jan 27, 2005
Messages
393
I'm trying to learn C and/or C++ because I've been programming in languages that take care of the dirty work for me (bounds checking, garbage collection, etc) and I think the experience would be beneficial. Generally when I've wanted to learn a new language I've had a project I wanted to write for myself and that was a way for me to learn. Unfortunately right now, there is nothing that I need to write for myself or anyone else.

I know this is a super broad question but do you guys have any ideas for a program that I could write that would guarantee that I will have to get into the nitty gritty-ness of the languages? (IE, lots of pointers, mallocs, basically everything I've taken fore-granted with C#, Java, Python, etc) It doesn't matter if there is a program already out there that does the same thing or if the program is remotely useful... just need an idea. I was thinking about doing something in C first and then moving on to C++ when I felt somewhat comfortable. Thanks in advance.
 
Build a webserver is a good one. Although your going to have to learn network programming at the same time. Look up Beej's guide to network programming. This one can be as simple or as complicated as you want to make it, at its simplest level you should be able to get something working in a day or two.

Build a virtual machine. This one is good because you don't really have to learn much beyond the core language. Start with a 4 bit computer. Make some registers too store data in. Then make a few op codes to load data into the registers, branch, etc. The first 2 bits is the op code the second to is the data to be operated on. Then program it in machine language. Bonus points for writing an assembler then a compiler.
 
any ideas for a program that I could write that would guarantee that I will have to get into the nitty gritty-ness of the languages? (IE, lots of pointers, mallocs, basically everything I've taken fore-granted with C#, Java, Python, etc) It doesn't matter if there is a program already out there that does the same thing or if the program is remotely useful... just need an idea.

Implement a red-black tree (or even just a simple binary tree or linked list). Have functionality to add, remove, and traverse.
 
Authoring a compiler is a tine-consuming project. For someone who's serious about writing tools, it's inevitable; but for a beginner, it's a an inappropriate idea because it will lead to nothing but confusion and frustration.
 
while i certainly agree with your sentiments that writing a compiler for a language will help you learn it, i disagree that to learn the language well you need to do this. that's like saying when you want to learn to drive a race car that you have to learn how every sensor works in the motor and learn every formula for fuel combustion before you can master the art of driving. obviously this isn't true.

if you learn the rules of the language and the rules of your compiler's implementation, you have mastered the language (granted, this is usually a very long process... especially for C++. i know of no person that i have met face-to-face who is an expert in C++ because the particulars of the language are VERY numerous).

may i ask.. when you wrote your compiler, what language did you write it in? how did you learn this language? did you write a compiler for it? how did you learn the language you wrote THAT compiler in? or did you write it all in assembly?

maybe you wrote parts in assembly and then used those parts of the compiler to write other parts of the compiler. while you may have done this, it is unnecessary. i know C quite well. i didn't have to write a compiler to learn it.
 
I wrote the C compiler in C, same way the other c compilers are made. I was learning the language as I wrote the compiler.

I never said you need to write a compiler for it, the question was "what is a good project to learn C?", so I answered with what I thought was best.
 
Back
Top