Getting started in C

Miscellaneous Forums/General Discussion/Getting started in C

I really want to start learning C but haven`t a clue where to start. Could anyone in the know give me a few pointers as to where would be a good place to start. Hopefully there is a free option but I do not mind paying a small amount if that is the only choice.

Also what are the different versions of C and what merits do each of them have. Which would be best for a begginer to learn and help me in the future etc...

Also how hard is C to learn over things like B3D\BMax?

Thank you for any advice you can give,
Jason.

I really want to start learning C but haven`t a clue where to start.
Don't. Learn C#, Java, Python or Ruby instead. Hell even Visual Basic is probably a more useful language than C.

Also what are the different versions of C and what merits do each of them have.
Basically there's ANSI C and "Everything else". The main advantage to ANSI C is that it's standardized.

Also how hard is C to learn over things like B3D\BMax?
Not particularly. Getting good at it is the hard part - learning it is easy.

Get a free compiler like GCC ( http://gcc.gnu.org/ )

Yup ANSI C is the standard. The ANSI C standard obviously changed over the years but the changes were miminal really.

C is a good language to learn in order to learn how to program.

Good luck, C was my first programming language and I still love it. There is less and less call for it these days but will stand you in good stead if you then move on to C++ and C#

There is less and less call for it these days but will stand you in good stead if you then move on to C++ and C#
I disagree. C++ is more difficult to pick up if you've started with C (at least it was for me), because (amongst other things) a lot of the same symbols, now mean something completely different. Also having a procedural (C) mindset is a hurdle when learning about object oriented concepts and languages (C++, but in particular C#).

I don't think I've used C (or C++) since 1997 - not for anything serious anyway. Java, C# or some Blitz variant all the way.

So to a complete novice what exactly is the difference between C,C++,C# Do they each have their own uses or are they just later versions?

Jason.

C is the programming language originally designed as a replacement for B by Dennis Ritchie while he was inventing Unix at AT&T Bell Labs.

C++ (or C with objects as it was originally called) is a language designed by Bjarne Stroustrup who was disappointed by the lack of objects in C, and the low performance of Simula.

C# is Microsofts version of Java. It's what C would have been, if it hadn't been invented in 1969 - or what C++ could have been if it wasn't invented in 1979 (and had not insisted on reusing C's existing keywords and operators in a new context).

While all C-like languages suffer greatly from a lack of direction, compactness and Single Point Of Truth, the newer the language, the greater the degree of compactness it has (although the .Net framework somewhat counteracts this effect due to it's inefficient interface for many classes). Hopefully in another decade or so, when we see the next iteration of C, it will more closely resemble Python.

Also by then .Net should have reached the infamous Microsoft Version 5 threshold for useful software.

One significant although not so important diffrence between C and C++, that may also be the origin of the name "C++" is:
where in C you would write
a=a+1;
in C++ you could use:
a++;
(and also a--, a+=1 etc.)

As mentioned before, C++ has some advantages over (ansi) C. Then again, C is maybe to most portable language. You may be able to port it to any computer and or chip.

Personally I thought the hardest part was to set up the enviroment for a C compiler: Some (msdos) Paths need to be set to allow the compiler to find some include files and binaries etc. Also, there's a number of frequently used include files, eg. for string operations or math. you have to know this since it's so basic that every tutorial simply skips these infos.

Unless you plan to port your source to the chip of a vacum cleaner or a coffee machine, you should start with C++ right away. Maybe C# is even the better choice since it simplifies the process of the enviroment setup (although portability is limited more than with CPP/C++).

Other than that, seek for beginner tutorials on google etc. there must be tons of them.

OK. Thanks for all the great info guys. I`ll have a look around now I have a better understanding of what I`m looking for.

Jason.

One significant although not so important diffrence between C and C++, that may also be the origin of the name "C++" is:
where in C you would write
a=a+1;
in C++ you could use:
a++;
(and also a--, a+=1 etc.)
Um, you can do a++ in C, too. ;)

If you want to learn ANSI C, I recommend getting the book 'The C Programming Language' by Brian Kernighan and Dennis Ritchie. They invented the C language so know what they're talking about. Just work though the book and do all the exercises.

Hopefully in another decade or so, when we see the next iteration of C, it will more closely resemble Python.


Actually, it'll more closely resembly Lisp, minus Lisp's syntax. Unfortunately, the real key to Lisps power is its syntax and how its simple syntax makes it trivially easy to modify data as code, prior to compilation, which allows unlimited extensibiliity to the language, and hence no language will really be as powerful or flexible as Lisp until it essentially becomes Lisp.

no language will really be as powerful or flexible as Lisp until it essentially becomes Lisp.


So true!

Anyway, you should probably read up on C99 too. GCC supports most of its feutures so you should be covered on most fronts.

Quote: Um, you can do a++ in C, too. ;)

oops. I used to read that many years ago, when I made a trip to c++ on atari ST (IIRC). All apps bigger than 32 KB crashed, so I went back to GFA Basic. Yes, I confess, I'm a natural born basic coder :P

ST had C++? o_O

The best reason to learn C/C++ these days is just in case you need to write a wrapper or glue code to some library wirtten in C/C++ so that you can interface with it from your language of choice.

Of course, if you plan on trying to get into the business and want to work on AAA titles, learning C and C++ is still a necessity unless you want to be relegated to scripting.

I've never been that impressed with C++, TBH. Always struck me as a pretty lame OOP bolt-on to C. :/

Object orientation and strict typing = headache + lots of hackish code to try and get around strict typing. Templates help...somewhat.


I really want to start learning C but haven`t a clue where to start. Could anyone in the know give me a few pointers



ha ha very funny

If you know BMAX then C++ will be an easy step.

Actually, it'll more closely resembly Lisp, minus Lisp's syntax.
Well, no.

One significant although not so important diffrence between C and C++, that may also be the origin of the name "C++" is:
Actually the origin of C++ I believe is a programmers joke. It's C, post incremented. Get it? Well it's not really funny unless you're a supergeek at MIT in the early 80's.

Object orientation and strict typing = headache
Yes. Well a LISP programmer isn't likely to understand it.


Actually, it'll more closely resembly Lisp, minus Lisp's syntax.

Well, no.



Considering that Ruby and Python are the two languages (in favor at least) that most closely resemble Lisp (in their feature sets, not sytax) I'd be willing to bet that the next C will more closely resemble Lisp, since it will naturally want to provide more powerful features that neither Ruby or Python currently offer.

Yes, C++ is so named because it means 'one more/better than C'. Oh, how I laughed. :/

For some application procedural programming is still better than OOP
For example scientific applications
OOP need and higher degree of abstraction , in some case it is a drawback
Consequently I would not suggest C# or Phyton
Go for C++ you can combine both programming styles

There was one compiler by Greg Comeau, as well as one Project named AGNUS. As well as Atari GNU C/C++. And maybe some more. Tho, can't remember the one I used. It was for free and I only remember it crashed when the exe was bigger than 32k.
EDIT must have been .PRG, not .EXE tho :)

Considering that Ruby and Python are the two languages (in favor at least) that most closely resemble Lisp (in their feature sets, not sytax)
You've got that backwards mate.

For example scientific applications
Well that's a rubbish example, considering Simula (the worlds first object oriented language) was made specifically for scientific simulations. The only thing procedural programming can be better for (as measured in man hours needed for completion) is a low complexity, high information application.

Go for C++ you can combine both programming styles
Not really. No. In BlitzMAX you can. In C++, not so much, because if you're not doing it object oriented you're just writing in plain C - and maintaining the code is going to be an absolute nightmare, because it's somewhat ambiguous which parts are written in C and which are in C++, and there is a fairly significant difference.

You've got that backwards mate.

I know you have some deep rooted hatred for Lisp, but that doesn't give you an excuse to spout off patent falsities. As far as language features go, Ruby and Python drew a lot of inspiriation from Lisp (as did Lua, which the language author has admitted.)

Here's an article that compares some of Ruby's features to Lisp's features, and how Ruby has managed to emulate Lisp in a lot of ways (but not all). It's even pro-Ruby, but it's a good article and mostly true. The only real drawbacks to Lisp are those mentioned within.

http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp

Well it's interesting that two people can read the same article and draw such different conclusions from it. I know LISP is everyones favorite toy for testing new silver bullets, but not all of them are powerful, even fewer are useful, and none of them actually are silver bullets. LISP requires too much work to get any program of significant complexity running. Python doesn't.

From a business perspective I couldn't care less if LISP where the second coming. As long at it takes 4 times as long to develop maintainable applications, and costs at least twice as much (because finding someone who is even remotely competent at LISP is several orders of magnitude more costly than finding one that is competent in Python [never mind Visual Basic]).

As a hobbyist language, I have no objections to people using LISP. Or assembly. Really, program in whatever outdated, backwards programming language you want. I used to code in assembly, I really do understand the appeal of programming gibberish.

And for the record I dislike PERL and C a lot more than I dislike LISP. If it makes you feel any better I will gladly concede that in 1958, when it was originally developed, LISP was the KING of programing languages, and Fortran should never have had the impact on the world that it did, possibly holding back advancements in IT by at least 5 years.

To me, LISP is sort of like the AMiGA. A good idea at the time that, due in large part to stubborn geeks, did not get the graceful retirement it deserved, instead its undying husk was dragged all over the place by childish bickering hatemongers (no offense, this happened way before your time, I'm sure). So sad.

Well, I'm pretty sure you're still basing all of your opinions off of a very outdated concept of what Lisp is and what it is capable of. I remember in another thread you thought that Lists were it's sole data type, and that hasn't been true for I dunno, 30-40 years or more.

I agree that some things can take longer in Lisp - but the real reason for that is just a sparse selection of libraries for most "common programming tasks" and the sole reason for that is that the Lisp community is just not large enough yet. I should add, that's probably the sole reason I or any other proponent of Lisp take the time to promote it.

Calling it backwards though, is ridiculous, as each year more and more of the popular languages get another feature or two Lisp has had for years.

I'd recommend the OP to check it out if he's looking at expanding his programming horizons. Although, of course, C or C++ are more logical choices for straight up game programming.

I apologize to QuickSilva for the thread derailment. In an attempt to make amends, I strongly recommend the book "Thinking In C++" as either your 2nd or 3rd book on C++ or your first book on C++ *after* you've come to grips with C.

The best part is it's free and available online here:
http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

"When your favorite tool is a hammer, every problem becomes a nail."

My advice is this; learn and use whatever you like and are productive with. The end user could care less what the language was or whether you are a procedural or OOP guy. As long as your software works as advertised no one will care but you and the assorted purists that show up on these types of forums.

I use C a lot, but I also program embedded devices for a living. As for Windows/MAC/Linux... there are many good options and you just have to try them all on for size. One or two will stand out and feel instantly familiar and sensible to the way you think and work.

My experience is this. Procedural programming is fast to write and efficient to run. OOP is slow to write and inefficient to run. Most businesses that areearning a living solving real world, real time applied computing problems are going to want procedural thinking types of guys. C and Assembly is NOT OOP, not now not ever. OOP is an abstraction. There is big money to be made in industry for the folks who still think and code procedurally. These types of apps need to be lean, mean and specific.

The flock will write OOP code for desktop apps/games and remain true to their academic/idealistic roots and poop on anyone who says or thinks differently.

If I missed the point of your "Learn C" question and you just want to create windows games/things then please ignore me and learn Latest OOP/GUI/OpenGL/D3D whizzbang language that will work for you.

Allan

http://www.cprogramming.com


Andy