Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C

Options
2»

Comments

  • Registered Users Posts: 413 ✭✭ianhobo


    Quake was C i think

    The source is here, for Quake I and II and III.

    http://www.idsoftware.com/business/techdownloads/

    Looking at the Quake source, it seems to be all C files


  • Closed Accounts Posts: 71 ✭✭Mach


    C is great for the basics (but I wouldn't use it for GUIs unless I have an IDE like lab view) once you know the basic you can program in almost any language, except maybe a functional language like LISP


  • Closed Accounts Posts: 25,848 ✭✭✭✭Zombrex


    Stamen wrote: »
    I was just thinking, if C programs are run in command prompt, you could make a text based game played from command prompt?

    New Challenge!!!

    I think two issues are getting confused here, a programming language and the GUI

    C is an old(ish) programming language, it was invent the late 60s.

    It follows the principles of structured programming, which was all the rave back then (still is, good ideas don't go out of fashion) which means it is designed to over come the "spaghetti code" that older programming languages allowed a (bad) programmer to write.

    It is a procedural language, you have data which you pass around to different "functions" that do something with the data and return some data, which you then you pass to other functions. This is how you get things done. The structural programming aspect comes in because functions are declared as distinct units of code. In the bad old days your program could jump all over the place from one point of the code to another, if you were a bad or inexperienced programmer. Tracking down bugs was difficult because you could be jumping around a 10,000 line piece of code.

    In a structured programming language the work is divided up into smaller units (functions) that do something and then return. Your program becomes a collections of specific functions, with data being passed around between them. This makes it easier to code and debug as you know that function A should be doing this, function B should be doing that.

    Because of its influence a lot of programming languages since, such as C++, Java, PHP have similar syntax and some functionality to C, even if they have moved away from procedural programming to object orientated programming (which most people still don't understand).

    C is often taught as a starter language because it is generally considered a good idea to get used to procedural programming before you move to something like object orientated programming. I can see the logic behind that, though some argue that this leads to people doing procedural programming with objects, rather than proper object orientated programming, because they are so used to procedural programming. So this is something to bare in mind. Object Orientated programming is more different that what most people think when they move to it.

    I would recommend looking at C, getting used to variables, pointers and functions, and then moving relatively quickly on to the OO functionality of C++

    As for GUIs, they are just programs themselves. To make a program do something with a graphical user interface you simply include a GUI library (collection of functions or objects that you can use in your own code) in your program, and make calls to the GUI functions. From the point of view of the program there isn't a huge amount of difference between talking to the GUI and talking to a database, or a file system, or the internet. It is all done with function calls to external libraries of code.

    So it would be wrong to view command line programs as being vastly different to GUI programs. GUI programs simply have extra code libraries add to them allowing them to send and receive messages from the GUI (create me a new window, draw this to the window, where is the mouse pointer now, did the user click that button etc etc)

    If you want to do something like a game you will need to talk to the GUI to draw your game, or the easier option is to use a library that already does that like SDL or DirectX. But that is quite complicated for just learning a programming language, as there is a lot of work involved in setting all this up.

    For just learning how to program you are better off staying, for the time being at least, away from complicated libraries such as a GUI library.


  • Registered Users Posts: 740 ✭✭✭junior_apollo


    Wicknight wrote: »
    I think two issues are getting confused here, a programming language and the GUI

    C is an old(ish) programming language, it was invent the late 60s.

    It follows the principles of structured programming, which was all the rave back then (still is, good ideas don't go out of fashion) which means it is designed to over come the "spaghetti code" that older programming languages allowed a (bad) programmer to write.

    It is a procedural language, you have data which you pass around to different "functions" that do something with the data and return some data, which you then you pass to other functions. This is how you get things done. The structural programming aspect comes in because functions are declared as distinct units of code. In the bad old days your program could jump all over the place from one point of the code to another, if you were a bad or inexperienced programmer. Tracking down bugs was difficult because you could be jumping around a 10,000 line piece of code.

    In a structured programming language the work is divided up into smaller units (functions) that do something and then return. Your program becomes a collections of specific functions, with data being passed around between them. This makes it easier to code and debug as you know that function A should be doing this, function B should be doing that.

    Because of its influence a lot of programming languages since, such as C++, Java, PHP have similar syntax and some functionality to C, even if they have moved away from procedural programming to object orientated programming (which most people still don't understand).

    C is often taught as a starter language because it is generally considered a good idea to get used to procedural programming before you move to something like object orientated programming. I can see the logic behind that, though some argue that this leads to people doing procedural programming with objects, rather than proper object orientated programming, because they are so used to procedural programming. So this is something to bare in mind. Object Orientated programming is more different that what most people think when they move to it.

    I would recommend looking at C, getting used to variables, pointers and functions, and then moving relatively quickly on to the OO functionality of C++

    As for GUIs, they are just programs themselves. To make a program do something with a graphical user interface you simply include a GUI library (collection of functions or objects that you can use in your own code) in your program, and make calls to the GUI functions. From the point of view of the program there isn't a huge amount of difference between talking to the GUI and talking to a database, or a file system, or the internet. It is all done with function calls to external libraries of code.

    So it would be wrong to view command line programs as being vastly different to GUI programs. GUI programs simply have extra code libraries add to them allowing them to send and receive messages from the GUI (create me a new window, draw this to the window, where is the mouse pointer now, did the user click that button etc etc)

    If you want to do something like a game you will need to talk to the GUI to draw your game, or the easier option is to use a library that already does that like SDL or DirectX. But that is quite complicated for just learning a programming language, as there is a lot of work involved in setting all this up.

    For just learning how to program you are better off staying, for the time being at least, away from complicated libraries such as a GUI library.

    +1 - Very good post


  • Closed Accounts Posts: 63 ✭✭Stamen


    hmmm, informative. :D

    When I'm finished C for dummies what should I do? Mr Dan Gookin (C guy) recommends another one of his books, C All in one desk reference, is it worth it or is the hinternet good enough.


  • Advertisement
  • Registered Users Posts: 3,568 ✭✭✭ethernet


    Stamen wrote: »
    hmmm, informative. :D

    When I'm finished C for dummies what should I do? Mr Dan Gookin (C guy) recommends another one of his books, C All in one desk reference, is it worth it or is the hinternet good enough.
    Did C in first year B. Sc. IT. Have both books. Read the smaller one first and then the all-in-one and found it very useful. Covers a lot, including more difficult/obscure things.


  • Closed Accounts Posts: 63 ✭✭Stamen


    Just ordered it. Thanks


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    every C programmer should have this book.

    http://www.amazon.co.uk/C-Programming-Language-2nd/dp/0131103628/ref=sr_1_1?ie=UTF8&s=books&qid=1216075317&sr=8-1

    it's not great to learn from, but as a reference guide it is pretty much your bible to all things C.


  • Closed Accounts Posts: 25,848 ✭✭✭✭Zombrex


    Cremo wrote: »
    every C programmer should have this book.

    http://www.amazon.co.uk/C-Programming-Language-2nd/dp/0131103628/ref=sr_1_1?ie=UTF8&s=books&qid=1216075317&sr=8-1

    it's not great to learn from, but as a reference guide it is pretty much your bible to all things C.

    Agreed, it literally is the C book (Dennis Richie invented C)


Advertisement