Jump to content
  • Advertisement
Sign in to follow this  
JonathanCCC

C as first language

This topic is 3476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all, so i've decided to learn and master C as my first language. I just want to make sure I have the standard software etc for doing so. At the moment I am on Windows XP and are using the Miracle C compiler, and that is it. Just to do basic programs and get used to the language. Is this ok? secondly, once i'm comfortable with it, what software should I get to create windows form link software with a GUI? and then after that, what game packages would I look at? I know they are a long way ahead, but i'm just curious. Finally does the visual C++ express compiler compile traditional C? or should I stick with Miracle C? thanks in advance Jonathan

Share this post


Link to post
Share on other sites
Advertisement
Why are you using this "Miracle C" for C programming? Using gcc or the Microsoft compiler makes a lot more sense (to me anyways).

Also, if you're wanting to do Windows and game programming, starting off with C is a "bad idea". It is, quite frankly, an antiquated language that is generally only used nowadays for very low level programming for drivers, microcontrollers, etc. If you want C-like syntax then I highly recommend giving C# a try. You'll thank me and everyone else who backs be up on this.

Share this post


Link to post
Share on other sites
hey thanks for the response

what is this gcc compiler, and which microsoft one are you talking about?

and I know C isn't the best language, the reason i'm wanting to start on it is for fun since I like programming in general, and to get an understanding of low-level programming before jumping upto C#. Just so I can appriciate and understand more of the inner-workings, and hey, i'm just doing it for fun at the moment so i'm not in a rush to build a game anytime soon. But I was just wondering what stuff I could use to play around with in C for GUI's and games, or is it true that it's just not really possible anymore with this out-dated language?

Share this post


Link to post
Share on other sites
GCC compiler.
Microsoft compiler

Writing a GUI in C would be a pain, in my opinion. Certain languages lend themselves to certain tasks. You can create GUIs and games in C, but it would be a lot of work for little or no extra benefit.

Commonly recommended beginner languages are Python and C#.

Share this post


Link to post
Share on other sites
The popular C++ compilers should be compliant with the majority of C. There are some later additions to C (the C99 standards) that I don't think are fully implemented in many C++ compilers, but the older standards are generally okay as far as I know.

I'm still fond of C. It has its place; Linux is still very C oriented, and it's a good language for low-level libraries. But C tends to get unwieldy when working on large applications, and there are more appropriate languages out there for GUI work. There's also a bunch of gotchas that can make it frustrating for beginner programmers; expect a bunch of bewildering debugging sessions. C is still a language that's worth learning - it's good for lower level algorithm implementation that needs to be compiled on different platforms. But beginners tend to get hung up on the syntax and bugs rather than learn the craft of good programming techniques.

I like Python as a less stressful language that's more beginner friendly. Everyone around here says good things about C# too.

Share this post


Link to post
Share on other sites
If you're going to stick with C, I recommend you check out Allegro and SDL, which are both low-level libraries useful for writing games written in C. Unfortunately most of the tutorials you will find are written in C++, but some, like the ones on this visually offensive Allegro tutorial site, are written in such a way that very little C++ is actually used, if any. You could skip the ones on classes and complete the Allegro section with no problem.

Share this post


Link to post
Share on other sites
Quote:


what is this gcc compiler, and which microsoft one are you talking about?


http://www.mingw.org/old/download.shtml

http://www.microsoft.com/express/vc/

Share this post


Link to post
Share on other sites
Quote:
Original post by JonathanCCC
and to get an understanding of low-level programming before jumping upto C#.


Would you train to become a mechanic before applying for a drivers' license? Don't make the task of programming hard for yourself.

Quote:
But I was just wondering what stuff I could use to play around with in C for GUI's


Would you learn how to drift before mastering parallel parking? Writing a program that uses a GUI properly (and avoiding lots of headaches and bizarre workarounds that seem to work most of the time) requires understanding a lot about how to design an *organized* program, and separate the task into its components neatly. Work on simpler problems first.

Quote:
and games


GUI development has nothing to do with game development. You can make a game in any language, from the first programming lesson onward. You just need to expand your definition of "game".

The gcc compiler is probably the best-known one out there, at least among those who've ever used something other than DOS and Windows. "Miracle C", OTOH, I've never heard of, and you can rest assured I've been around a long, long time ;)

Share this post


Link to post
Share on other sites
C may not be very beginner friendly, but it does have some virtues as a first language.

Firstly, C is the "lingua Franka" of computer languages -- The common tongue: just about every single programmer on earth can "speak" in C, even if its not their prefered language. I daresay that more open-source and example code is written in C, as well as code within published papers, than in any other language. Further, the syntax constructs themselves of many more recent languages share a great deal with C -- Objective-C, C++, C#, D and many others.

Second, it really is a "structured assembly language" -- meaning that its easier to see how C translates to machine code than many OOP, dynamic or JIT/interpreted languages are -- at least with the traditional model of what a computer is -- though this is changing with more and more parallel and distributed computers.

Third, most folks seem to grasp procedural programming easier than other styles. OOP, for example, requires too much up-front effort to implement a good design than a fresh-faced programmer is usually able to muster. Functional programming is too much of a head-trip for many, though it seems more natural for those with a particularly strong mathematical bent.

Finally, and anecdotally, C seems to foster an attitude of "do it myself once, then find/make a library" -- Many new languages like Java, or any of the .NET languages have such extensive support libraries that most folks end up never rolling their own, even once. This is not a bad thing in and of itself, in fact its quite contrary in a non-learning environment, but my own oppinion is that doing is the best way of learning -- you simply understand that doubly-linked list more intimately by writing it yourself, and you gain valuable insight into its pre-packaged implimentations (which are for certain faster and better tested than your own.) I guess that whether you see this as a benefit or not is down to whether you're a top-down or a bottom-up kinda person.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ravyne
C may not be very beginner friendly, but it does have some virtues as a first language.

I agree with your arguments. That's why I recommend every programmer learn C. But while I feel C makes a excellent second language, I think it's a bit unwieldy as a very first language. All the extra steps to go through the compiler process, add in header files, function declarations, memory management issues and strange error messages (such as the dreaded seg faults) can be really disheartening to someone who have never programmed before.

I think interpreted languages like Python are a better introduction. Beginners can start with a few commands in an interpreter to get an overview of the language before diving into writing programs. They can also avoid the problems with managing memory and get down to solving programming problems. Once a beginning programmer has got the basics of how to break down a problem into implementable chunks, and how to debug their code in a more friendly language, then they'll be better able to approach a more thorny language like C.

Of course, you might be able to start with C if you've got a C programmer who is good at teaching to help you. My experience in teaching C labs is that most beginners will hit a show stopper problem that requires advice to solve. I feel there's a danger for C beginners that without ready help they might get too frustrated and quit learning programming altogether.

For the record, C wasn't my first langauge. I learned with BASIC. I don't think I'd have picked it up as readily if I didn't already have that experience.

Edit: I might be derailing from the original argument somewhat [smile]. I guess my tip to the OP: if you're learning C and find it a bit too confusing, don't get too frustrated with programming in general. If you feel really stuck, try another higher level language for a bit and plan to come back to C later. And don't be afraid to ask C questions in the this forum when you hit a serious problem!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!