Jump to content

Want to learn C

Veryplayable

Hello, for a few years, iv always been interested in programming and dabbled around in it. I started with HTML and css, but I am more interested in programming, then web design. I started learning Java but then I decided for various reasons that I would switch to c/c++. Iv watched some videos and read some stuff, but not really got anything that will really get me started. Do you guys know of any good resources? Thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

Unless you want to get down and dirty with memory yourself, I recommend you avoid it like the plague :D

 

I enjoyed doing python last semester, but I did C/C++ this semester and was miserable. May have just been the teacher for me, though.

i5 4670k | Sapphire 7950 | Kingston 120GB SSD | Seagate 1TB | G.Skill Ripjaw X Series 8GB

PB238Q | Steelseries Sensei | Ducky DK9087 | Qck Heavy

Build Log: http://linustechtips.com/main/topic/44902-from-imac-to-my-own-creation/

Link to comment
Share on other sites

Link to post
Share on other sites

Unless you want to get down and dirty with memory yourself, I recommend you avoid it like the plague :D

 

I enjoyed doing python last semester, but I did C/C++ this semester and was miserable. May have just been the teacher for me, though.

If I may ask, what was so bad about it?

Link to comment
Share on other sites

Link to post
Share on other sites

check out udacity.com

they offer free courses teaching you python and java

CPU: i5 3570K; Motherboard: ASUS P8Z77-V; RAM: Corsair Vengeance (2x4GB); GPU: MSI R7850 Twin Frozr; Case: Thermaltake Commander MS-I Snow Edition; Storage: Western Digital Caviar Blue (500GB); PSU: Thermaltake Modular PSU 750 Watts

Link to comment
Share on other sites

Link to post
Share on other sites

If I may ask, what was so bad about it?

Very technical at times and various minor things that threw you off. Also debugging can be difficult at times if you ask me. 

 

 

Bump

Don't believe this is allowed here

i5 4670k | Sapphire 7950 | Kingston 120GB SSD | Seagate 1TB | G.Skill Ripjaw X Series 8GB

PB238Q | Steelseries Sensei | Ducky DK9087 | Qck Heavy

Build Log: http://linustechtips.com/main/topic/44902-from-imac-to-my-own-creation/

Link to comment
Share on other sites

Link to post
Share on other sites

Definitely learn C++, it's a fantastic language. Find a basic tutorial online and after completing that you should pretty much be able to guess the rest of the steps because you learned c syntax with Java.

Link to comment
Share on other sites

Link to post
Share on other sites

If I may ask, what was so bad about it?

No Garbage collection on C++ is definitely a pain, if you're not worried about it all the time, and even though Software side & most big games use C++ for many reasons, really Java is an upgraded version of C++ in my mind. All languages are really just based on what you want to use it for, since even Pearl's a great language for certain things. I happen to work with C++ a lot, but the whole learn c thing will be a bit of a pain, since C# isn't really just like C++, or anything they are similar, and all, but both have a lot of differences.  I'd recommend starting out with a language like Java that's pretty powerful, since it's still a high level programming language that actually works on any OS if it has Java on it, since it decodes it it's self, and it'll a better starting point for you to learn Object Oriented programing.    If you're fully dead set on skipping it then disregard what I said, but you probably don't want to .

"Her tsundere ratio is 8:2. So don't think you could see her dere side so easily."


Planing to make you debut here on the forums? Read Me First!


unofficial LTT Anime Club Heaven Society

Link to comment
Share on other sites

Link to post
Share on other sites

No Garbage collection on C++ is definitely a pain, if you're not worried about it all the time, and even though Software side & most big games use C++ for many reasons, really Java is an upgraded version of C++ in my mind. All languages are really just based on what you want to use it for, since even Pearl's a great language for certain things. I happen to work with C++ a lot, but the whole learn c thing will be a bit of a pain, since C# isn't really just like C++, or anything they are similar, and all, but both have a lot of differences.  I'd recommend starting out with a language like Java that's pretty powerful, since it's still a high level programming language that actually works on any OS if it has Java on it, since it decodes it it's self, and it'll a better starting point for you to learn Object Oriented programing.    If you're fully dead set on skipping it then disregard what I said, but you probably don't want to .

 

C++ doesn't need garbage collection, it has destructors... whenever a class loses its reference in c++ it automatically has its destructor called and the memory is freed up...

Link to comment
Share on other sites

Link to post
Share on other sites

For C, I recommend "The C Programming Language". It's a great book, and since C is

not a very large language you'll be able to work through it rather quickly.

Also, check out the programming resources thread, this is what it's for. ;)

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

For C, I recommend "The C Programming Language". It's a great book, and since C is

not a very large language you'll be able to work through it rather quickly.

Also, check out the programming resources thread, this is what it's for. ;)

This is a good idea. Book was written by Kernigan and Ritchie, founders of c at Bell Labs. I would also recommend the Brian Brown C tutorials however. I just finished a course where this book and tutorial set were used together. It was fantastic.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 4 weeks later...

C++ doesn't need garbage collection, it has destructors... whenever a class loses its reference in c++ it automatically has its destructor called and the memory is freed up...

I guess I don't pay enough attention to updates...when did that start happening?

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

I guess I don't pay enough attention to updates...when did that start happening?

 

Errr 2011 standard or earlier 0.o, however if you dynamically create memory using malloc then you still need to free it... and you must implement the destructors anyway... its not the same as garbage collection, it is C++'s own way of handling cleaning up memory used due to creating Objects... pretty much the inverse of a constructor...

Link to comment
Share on other sites

Link to post
Share on other sites

I guess there is a bit of confusion about the subject of garbage collection (although I have probably gotten a bit sloppy on terms, I will try to straighten a few things up)

 

C++ and C don't really have garbage collection (You have to manually handle the memory objects).  Yes C++ has destructors, but they do not replace garbage collection, they are there to allow you to clean up the object properly (like if an object has allocated memory using things such as malloc or new).

Just like void test() { int i; return; } in C will create a space for i and then delete it afterwards this doesn't really constitute as garbage collection because it was all locally available in stack.

 

C++ and C could have garbage collection (by exploiting the fact the stack gets cleaned up), but I find the implementations are a bit cumbersome...I find it a lot easier just having manual memory management (although you do need to be careful)....with that said, since there are no real garbage collectors in C++ you have the issue that you need to clean up the memory that you have allocated (ie. if you use malloc as @jam08060 has said, or even if you use new, you must then use delete to clean up the memory).  So the importance of the deconstructor in C++ was cases where an object has allocated extra memory using new or malloc (as to clean up the memory)

 

On a side note @ehsanawan was there really a need to make so many posts in old threads (and in some cases giving the same answer the first responder said)

0b10111010 10101101 11110000 00001101

Link to comment
Share on other sites

Link to post
Share on other sites

I guess there is a bit of confusion about the subject of garbage collection (although I have probably gotten a bit sloppy on terms, I will try to straighten a few things up)

 

C++ and C don't really have garbage collection (You have to manually handle the memory objects).  Yes C++ has destructors, but they do not replace garbage collection, they are there to allow you to clean up the object properly (like if an object has allocated memory using things such as malloc or new).

Just like void test() { int i; return; } in C will create a space for i and then delete it afterwards this doesn't really constitute as garbage collection because it was all locally available in stack.

 

C++ and C could have garbage collection (by exploiting the fact the stack gets cleaned up), but I find the implementations are a bit cumbersome...I find it a lot easier just having manual memory management (although you do need to be careful)....with that said, since there are no real garbage collectors in C++ you have the issue that you need to clean up the memory that you have allocated (ie. if you use malloc as @jam08060 has said, or even if you use new, you must then use delete to clean up the memory).  So the importance of the deconstructor in C++ was cases where an object has allocated extra memory using new or malloc (as to clean up the memory)

 

On a side note @ehsanawan was there really a need to make so many posts in old threads (and in some cases giving the same answer the first responder said)

 

What I said but in more words 0.o

Link to comment
Share on other sites

Link to post
Share on other sites

What I said but in more words 0.o

Yea, very similar...the only thing I wanted to stress was destructors are not the reason C++ doesn't "need garbage collection", but rather desctructors are partly there because there is no garbage collection....but yea, I pretty much agree with that you said :P

0b10111010 10101101 11110000 00001101

Link to comment
Share on other sites

Link to post
Share on other sites

I guess there is a bit of confusion about the subject of garbage collection (although I have probably gotten a bit sloppy on terms, I will try to straighten a few things up)

 

C++ and C don't really have garbage collection (You have to manually handle the memory objects).  Yes C++ has destructors, but they do not replace garbage collection, they are there to allow you to clean up the object properly (like if an object has allocated memory using things such as malloc or new).

Just like void test() { int i; return; } in C will create a space for i and then delete it afterwards this doesn't really constitute as garbage collection because it was all locally available in stack.

 

C++ and C could have garbage collection (by exploiting the fact the stack gets cleaned up), but I find the implementations are a bit cumbersome...I find it a lot easier just having manual memory management (although you do need to be careful)....with that said, since there are no real garbage collectors in C++ you have the issue that you need to clean up the memory that you have allocated (ie. if you use malloc as @jam08060 has said, or even if you use new, you must then use delete to clean up the memory).  So the importance of the deconstructor in C++ was cases where an object has allocated extra memory using new or malloc (as to clean up the memory)

 

On a side note @ehsanawan was there really a need to make so many posts in old threads (and in some cases giving the same answer the first responder said)

Ok, it sounded like they implemented objective-c style reference counting and I got confused.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

Yea, very similar...the only thing I wanted to stress was destructors are not the reason C++ doesn't "need garbage collection", but rather desctructors are partly there because there is no garbage collection....but yea, I pretty much agree with that you said :P

 

Ok, it sounded like they implemented objective-c style reference counting and I got confused.

 

I personally don't like garbage collection all that much because I much prefer controlling my own memory usage... so for my usage it is a direct replacement...

 

This is probably because I do tend to write programs that are memory heavy multi-threaded programs and garbage collection likes to take its sweet time cleaning up memory sometimes...

Link to comment
Share on other sites

Link to post
Share on other sites

I personally don't like garbage collection all that much because I much prefer controlling my own memory usage... so for my usage it is a direct replacement...

 

This is probably because I do tend to write programs that are memory heavy multi-threaded programs and garbage collection likes to take its sweet time cleaning up memory sometimes...

Completely agree, manual memory management is the best (Unless you work with someone who neglects to put in deletes and frees).  I get what you are saying about the direct replacement though (if I am not mistaken that is how garbage collection in C++ is implemented, through special classes which count using constructors and destructors).

0b10111010 10101101 11110000 00001101

Link to comment
Share on other sites

Link to post
Share on other sites

Completely agree, manual memory management is the best (Unless you work with someone who neglects to put in deletes and frees).  I get what you are saying about the direct replacement though (if I am not mistaken that is how garbage collection in C++ is implemented, through special classes which count using constructors and destructors).

 

I would imagine, but pfft if people are building & using garbage collection for C++ then they are completely missing the real fun of the language! :D

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×