Thread: Why C?

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    Why C?

    Mmm... there is something I want to know about everyone here...

    Why you learn C?

    Do you use C to solve your problems?

    How do you think about C and other programming languages?



    I hope this thread will be a motivation to everyone whose learning C.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    because...... that's why.

    I started learning C a year ago, why? Because I like it, it's classic, many programming languages have been influenced by C. You learn C, other programming languages will be a cinch to learn. It's not a big language, but its really powerful and fast since its a compiled language and one of the most widely used and documented.

    I'm going to start to learn more programming languages like C++, the cool Python (which is more of a scripting language) or PHP for websites, but C is definitely a good choice to start with and I really like it.

    I still haven't used C to solve a big or important problem, but hey, I just started with it.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    C/C++ is the language to learn. As samus stated, a lot of other languages are based on it, so knowing C/C++ lets you pick up, or at elast read through, those languages with minimal effort.

    I have solved major problems ith C/C++, and the development time it would have taken to do it in other languages would have cost several millions, not to mention collateral loses. C/C++ is so flexible that it lets you impliment pretty much any solution you want, without having to tailor the solution to the capabilities of the language. Other languages tend to focus on specific classes of problems, like Java is mainly for the web, PhP is mainly for web based databases, I havent really worked with Python enough to say what its best at, but from what I hear its mainly for rapid active development of server side processing.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I learned C so I could write a few programs that need to run very fast. I don't do a lot of problem solving with C, (where "problem solving" is defined as something I can't figure out, with paper and pencil), because I'm too slow with C, and C requires a lot of attention to the details of it's syntax. When I problem solve with code, I want to concentrate on the problem, completely, and not have to think about the right syntax for the language I'm using. If the run time is then too slow, it gets a new version of the program, in C.

    Every language has it's strong and weak points. I'd never use C for AI, for instance. An unexpected benefit of C is the feeling you get of being closely connected to the computer's hardware. In some mysterious way, that leads me to write better code many times, than I would when I'm using a higher level language.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by audinue View Post
    How do you think about C and other programming languages?
    Myself, I do not see why people choose C over C++, in a sense that C++ has everything C has and more.
    So we could just make everything C++ and get both languages in one.
    (This, of course, assumes that it is possible to choose C++ for the specific task the programmer is about to do. If only a C compiler exists, or if the code to be maintained is C, then I can understand why they would choose C.)

    Although if we compare C++ against other languages, it's no doubt that C++ is the best IMO. The way it's designed allows for fast, and efficient code. And if necessary, C++ allows low level code aka C, close to the hardware.
    In essence, C++ is the king (or queen?) of programming languages IMHO.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Is C++ efficient as C. I mean is there something you can do faster in C than in C++? (not a rhetoric question really asking )

    C is simple. That is why I like it. You know exactly what is going on and what your code does. The main reason I use it is because it is simple to start it and hard to master. Other languages, like Java, are more difficult to start with but easier to master. I like the easy start on things

    It has some drawbacks though compared to other languages.
    1) It is really, really, really difficult to understand what a big program does. Not difficult, but time consuming. It is easier in C++/Java, because you have classes to organize big things. No confusing pointers. And let's not forget that there are other languages with different philosophy, like Haskell, that make C look really ugly. You can write a code in Haskell in 2-3 lines, like a sorting algorithm, in C you would need like 10-20 lines.
    2) Debugging. In C a program can run seemingly correctly but contain a bug that will crash it a nice sunny day. It is then quite difficult to find it especially in a 5k line program. Other languages, like Java, restrain you from a lot of things (cough cough pointers) so you cannot make a very serious and debugging-consuming errors.
    3) MOST IMPORTANTLY it lacks some very nice features. Like exception handling. Like templates or generics. No inheritance. It is not an OOP.
    4) Modern languages focus more on modern problems. Like making a GUI it is much easier in Java than in C. Because Java has better libraries and it is OOP, so it is much more suited for the task.

    My say is that if you don't really want exception handling and/or multiple types and you don't really depend on libraries (as you would do with a GUI), the rest more or less can be done in C fairly easily, requiring you spent time to make the necessary functions.
    Last edited by C_ntua; 06-20-2008 at 02:56 PM.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    When I started to learn C in the mid-1980's, C++ had just started to be developed in full, and very few people actually used C++ at the time - there were no "real" C++ compilers, all C++ compilers at that time produced C code and used C as "a high level assembler".

    At the mid-1980's, for many things, the only reasonably reliable compiler was either Pascal or C compiler. Some systems had Pascal, others had C. If you wanted to be able to work with more than one system, you probably needed to learn both.

    I also learnt Basic (several dialects, although never Quickbasic/Visual Basic), Pascal, Modula-2, Simula-67, Fortran (a little), Lisp and I know several assembler dialects (x86, 29K, 68K, PDP-11, VAX-11, Z80, 6502, 8051 in (roughly) the order of most used to least used).

    I only properly started using C++ when I started a new job in August 2007. I had however used Pascal with object orientation, as well as Simula-67 [that's the language Bjarne took most of the ideas for object orientation of C++ from - at least in the early stages].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by C_ntua View Post
    Is C++ efficient as C. I mean is there something you can do faster in C than in C++? (not a rhetoric question really asking )
    Yes! To the first and I'd say no for the second.
    A good implementation in C++ can be faster than C due to the already existing tools and libraries that will do a good, if not better job, than equalient C implementation many times due to the difficulty in doing so. The thing to note is that the libraries are tested, optimized C code, basically.
    That is not to say C can do the same, because it can. But for the amateur develop, the libraries may just be faster.
    And despite being so low-level, C++ offers some things, such as templates that C does not. Template meta programming can actually produce faster code than C in some situations, so the both languages are dead on.

    3) MOST IMPORTANTLY it lacks some very nice features. Like exception handling. Like templates or generics. No inheritance. It is not an OOP.
    That's what C++ was designed to do - to be today's C. To stay true to the roots while offering a slew of other tools such as generics, polymorphism, classes, templates, inheritance and such.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    Quote Originally Posted by Elysia View Post
    That's what C++ was designed to do - to be today's C. To stay true to the roots while offering a slew of other tools such as generics, polymorphism, classes, templates, inheritance and such.
    I'll buy me a book on C++ and start learning then!

    Oh and about what I think of other programming languages... I'm pretty new to the programming world but I've seen that definitely, different programming languages are for different things. I tried Java once and was pretty difficult, it was like a C++--, but It has extreme portability (you can even program cellphones easily) and apparently making GUIs is far easier than C.

    I like Python cause I've written some math programs really fast and easily in python. I don't like it cause to run a python program you NEED the interpreter and you NEED the source, so I can't share them with my 'not computer inclined' friends. So I use the little I know from python only for myself, to do fast things (and I believe the python interpreter is written mostly in C )

    I've used PHP but that is entirely different and I really don't know much about it, just that this site's vbulletin is written in it, or a famous example like facebook.

    I don't understand what Perl, Ruby or Ada are for... Thing is that I think you should learn every language you can, that way you'll really be invincible and be able to do whatever you want with a computer.

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by samus250 View Post
    I'll buy me a book on C++ and start learning then!
    Yes, having a book on a language is always nice . . . .

    Oh and about what I think of other programming languages... I'm pretty new to the programming world but I've seen that definitely, different programming languages are for different things. I tried Java once and was pretty difficult, it was like a C++--, but It has extreme portability (you can even program cellphones easily) and apparently making GUIs is far easier than C.
    Java tries to protect you from making mistakes. You can't (really) leak memory, because there's a garbage collector. You can't have dangling pointers, because there are no such things as pointers. If you overflow an array, you'll just get an exception, not seemingly random segmentation faults or whatever. You can't miss an exception, because a method has to declare what exceptions it can throw.

    On the other hand, Java also forces you to program in an object-oriented style, and all of this checking and making sure the programmer stays in line is inefficient.

    I don't like Java much myself, but some people do. I don't know about making GUIs in Java -- I can't imagine it's much harder than making GUIs in C with GTK+ or in C++ with wxWidgets.

    I like Python cause I've written some math programs really fast and easily in python. I don't like it cause to run a python program you NEED the interpreter and you NEED the source, so I can't share them with my 'not computer inclined' friends. So I use the little I know from python only for myself, to do fast things (and I believe the python interpreter is written mostly in C )
    Well, you could always give your friends the Python interpreter as well. But it's annoying, I agree.

    (Note that you can "compile" Python source so that no one else can read it, if you were so inclined. The Python interpreter is still required, I think, though.)

    I don't understand what Perl, Ruby or Ada are for...
    Perl is a really nice text-processing language, with regular expressions built into the language. Of course, Perl can do a lot more than just that -- there is a collection of modules on CPAN that can do just about anything you could imagine . . . .

    I can't say much about Ruby or Ada, except to say that Ada is rather old (but hey, so is C!) and Ruby is quite new.

    Thing is that I think you should learn every language you can, that way you'll really be invincible and be able to do whatever you want with a computer.
    Well, don't try to learn like seven different languages when you're just starting out -- you'll just confuse yourself. For now, just pick a language and stick with it, until you understand the basic ideas of a programming language. After a while, though, it's very nice to know several different languages, because different langauges are better suited for different tasks.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Why you learn C?
    I was the lowest level of programming taught at high school.

    Do you use C to solve your problems?
    Usually it is easier to buy software rather than write a program to solve problems. I don't currently use C at work. If I'm using C it's usually for fun.

    How do you think about C and other programming languages?
    C is more low level then other programming languages. That makes it more powerful, but harder to work with.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  12. #12
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Quote Originally Posted by samus250 View Post
    I'll buy me a book on C++ and start learning then

    Oh and about what I think of other programming languages... I'm pretty new to the programming world but I've seen that definitely, different programming languages are for different things. I tried Java once and was pretty difficult, it was like a C++--, but It has extreme portability (you can even program cellphones easily) and apparently making GUIs is far easier than C.
    Java is easier than C++. C++ has a very steep learning curve. Java's swing library is great, because it is an easy to use library that comes with the language. Those two thing together make it very popular for beginners to do GUI work.

    Just a warning. I prefer C++ myself, but if you want to be writing complex programs sooner, then Java is a better choice to learn.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  13. #13
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Elysia View Post
    Myself, I do not see why people choose C over C++, in a sense that C++ has everything C has and more.
    I like that C exists as it does at the moment. Otherwise, whenever I'd say something about C++, everyone will start talking about their mapvectorstrings and overloaded friendclasses. But when I say it's C, then I get none of that.

    That is also why there is C subforum here - to have a place where everyone doesn't suggest you to use C++ monstrous systems. This way everyone can get the information they need - if they want to do it theirself, they ask it here, if they want to use existing std libraries, they ask it in the C++ forums.

    Quote Originally Posted by King Mir View Post
    Just a warning. I prefer C++ myself, but if you want to be writing complex programs sooner, then Java is a better choice to learn.
    This is the good old quality VS quantity dilemma.
    Last edited by maxorator; 06-21-2008 at 01:06 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed