Jump to content



Photo

Role of "C" programming language for a beginner?

role of c why c important for beginner why c why i should learn c before? why c prefered initially? where we are using c? advantages if i prefered c

  • Please log in to reply
57 replies to this topic

#1 narayan594

narayan594

    Resident One Post Wonder

  • Joined: 13-May 14

Posted 13 May 2014 - 04:09

Please any one help me with your suggestion......

I need a reason for why C.




#2 mastercoms

mastercoms

    Expert Microsoft Fanboy & C# Coder

  • Tech Issues Solved: 3
  • Joined: 21-May 13
  • Location: Marietta, Georgia
  • OS: W8.1U1 + Fedora 20
  • Phone: Lumia 928 WP8.1U1 Black

Posted 13 May 2014 - 04:36

Most languages are based off of the syntax of C, and it's widely used. Also, it's low level, so you get more experience, but I think Javascript is a better beginner language since it's easier and includes pretty much the same syntax, just a few kinks and new things you can do, and bam, you know C :p



#3 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 13 May 2014 - 04:46

Compared to other programming languages, C is small and low-level. This means that there aren't many concepts in it, and that these concepts closely map to how computers execute code at the machine level. This is both a learning opportunity and a stumbling block, depending on what it is you're trying to learn. As a systems programming language, I think C should be required to learn computer architecture, but as a general-purpose programming language, it's not representative of most popular languages in use today, and its antiquated compilation model and poor standard library features greatly aggravate its learning curve.

 

This is a matter of debate; some CS curriculums start with a high-level language such as Python, others with a low-level language like C. One can argue both ways. I fall firmly in the first camp, as most people today, I think. Therefore I would advise against learning C first and instead use a high-level language with out-of-the-box REPL support such as Python, Ruby or F#. See:

 

http://programmers.s...amming-language

http://programmers.s...t-programm?rq=1

http://mcsp.wartburg...thon-first.html

http://lifehacker.co...6243/1497409477

 

etc.

 

Above all else avoid verbose, complex, multi-paradigm languages like C++ and Java. One thing at a time.



#4 +Majesticmerc

Majesticmerc

    Resident Idealist

  • Tech Issues Solved: 8
  • Joined: 24-August 05
  • Location: United Kingdom
  • OS: Arch Linux / Win 7
  • Phone: HTC One X

Posted 13 May 2014 - 12:25

It depends very much what you're looking to do. C is a low level language, so there are less safe guards in place like you would get with higher level languages such as C#, Java, Python et al. You do get a much more direct interface to the underlying architecture though, and it's a very simple language to learn. I know that Andre and I disagree quite a lot in this regard (although he does raise good points, and I respect his opinion), but I think C is a good language to learn early on purely because it's simple, and it gives you an very clear idea what your code is doing with regards to memory management, basic data structures and the like.

 

The caveat of such a simple and low level programming language of course is that building large applications is much more involved compared to higher-level languages, which means that if you want flashy interfaces and are more interested in things like web programming, C probably isn't the way to go. Otherwise, I recommend it. Even for higher level languages, what you learn in C is very transferable.



#5 _dandy_

_dandy_

    Neowinian Senior

  • Joined: 07-May 04

Posted 13 May 2014 - 12:45

I would argue that if you can learn to program in C effectively, you'll migrate to higher-level languages with ease.  Going at it the other way around in no way guarantees success.

 

C forces you to think about what it is you're about to do, whereas higher-level languages are more forgiving, so if you only learn those, you'll be developing bad habits and become part of the crowd that thinks "just throw more memory at it" is a perfectly acceptable solution when your software turns into bloatware.

 

That being said, I'm not suggesting you actually try to use C in production applications.  These days I see it as an important learning tool and not much else.



#6 Thief000

Thief000

    Neowinian

  • Joined: 24-December 05

Posted 13 May 2014 - 13:17

Everybody here makes a valid point. You can do pretty much anything once you have mastered the C++ language, but isn't the easiest and will require dedication to master and find your own programming flaws to learn from yourself.

I myself am a C# programmer and prefer the safety of it as you can write very inefficient and pretty much redundant code in C++ very easily as a beginner or inexperienced programmer (though the newer Visual Studio IDEs do a lot to help).

It all depends on what you want to be able to do on a machine but if you really want to be able to do anything, I'd say FORTRAN or assembly (really dependant on computer architecture) is the way to go, but they have a level of complexity that are not for everyone. C is pretty much universal and I'm in the camp that would say learn a lower level programming language first as the more experienced you become with it, the more you can do, which is a great plus on a CV.



#7 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 13 May 2014 - 17:34

I know that Andre and I disagree quite a lot in this regard (although he does raise good points, and I respect his opinion), but I think C is a good language to learn early on purely because it's simple, and it gives you an very clear idea what your code is doing with regards to memory management, basic data structures and the like.

A first language should be simple, and C is simple, so that's one good reason to learn it. However, should a first language closely map to hardware-level abstractions, I think is a mistake. It is too far removed from the problem domain space and makes reasoning about algorithmic considerations difficult because the language is so different from mathematics and contains virtually no useful abstractions for algorithmic purposes. This is why the SICP uses Scheme for instance.

 

Also, there's a good reason not to use it, and that's the lack of an REPL, coupled with a complex, rigid compilation system including hand-written metadata (headers) and a linker step which complicates matters uselessly for beginners.

 

Given that there are simple languages that do not present these difficulties and are better suited for reasoning about algorithmic considerations, I think C is not a particularly good choice as a first programming language.

 

I do agree that C should be required learning as part of a CS degree because it's a useful tool to learn about hardware-level abstractions (and one should know at least one systems programming language). But as an introduction to programming, there are better choices.



#8 _dandy_

_dandy_

    Neowinian Senior

  • Joined: 07-May 04

Posted 13 May 2014 - 19:36

[...]

But as an introduction to programming, there are better choices.

 

I'm gonna disagree *if* someone wants to get serious about programming.  If you wanna do it for a hobby, great--stick with the higher-level languages.

 

But one thing C did when I was in college (over 20 years ago now) was to quickly separate those students who actually wanted to program, and those who were there merely because they had heard there was money to be made in this career path.  We started with over 30 students.  After the first semester, we were down to 15 or so (or was it the first *month*?)...the next 2.5 years were all C++...and clearly, I would NOT want those who couldn't handle C/C++ today as coworkers--even though I now haven't written one line in those languages myself in nearly a decade.

 

As for the claim that "a first language should be simple"...again, I'm gonna disagree.  It took some fellow students nearly 2 years to finally figure out that they weren't cut out for programming.  Had the only languages been taught been something simple, they would've started their careers ill-equipped, and would've hit a wall early on.  At least by starting with a "hard" language, the expectations are set more realistically.



#9 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 13 May 2014 - 20:10

But one thing C did when I was in college (over 20 years ago now) was to quickly separate those students who actually wanted to program, and those who were there merely because they had heard there was money to be made in this career path. 

What specific property of the C language do you think helped achieve this? 

 

As for the claim that "a first language should be simple"...again, I'm gonna disagree.  It took some fellow students nearly 2 years to finally figure out that they weren't cut out for programming.  Had the only languages been taught been something simple, they would've started their careers ill-equipped, and would've hit a wall early on.  At least by starting with a "hard" language, the expectations are set more realistically.

But the C language is simple, i.e. it contains very few concepts. There are basically just "regular" free functions and plain old datatypes, only the most basic control structures (if, while, for, switch, etc), very few built-in types, etc. So if you disagree that a first language should be simple, why are you advocating C? 

 

By the way, I am not saying that only simple languages should be taught; just that, like in any other domain, you start out with the lowest possible barrier of entry. You don't teach integral calculus in an introductory course to mathematics. Presenting very complex and quirky languages (say C++) as first exposure to programming may discourage many people that would otherwise have succeeded just fine, because it gives the wrong impression. 



#10 spikey_richie

spikey_richie

    XXXIII

  • Tech Issues Solved: 5
  • Joined: 02-February 05
  • Location: Nuneaton, UK
  • OS: Windows 8.1u1 Pro 64-bit
  • Phone: Sony Xperia Z1

Posted 13 May 2014 - 20:15

The first language I was taught was Pascal back in 1997. I thought that gave me a good footing to get into C, however I was thrown into the deep-end with embedded C++ on the Hitachi Workbench which put me off for life. I then migrated to VB5/6 & VBA and a small amount of HTML (back in like 1999) but never made the jump into OOP (.Net), as I changed role to become a test analyst. I still dabble in the odd bit of VB/A and HTML but I'm very much a novice.



#11 _dandy_

_dandy_

    Neowinian Senior

  • Joined: 07-May 04

Posted 13 May 2014 - 20:55

What specific property of the C language do you think helped achieve this? 

 

The fact that it's a down-to-the-metal language (well, without going full-blown assembler).  You have to manage memory yourself, you have to get a good grip on pointers before you start avoiding dumb mistakes, there's no built-in routines or libraries for even simple things like sorting, you have to learn about makefiles and compiler/linker settings (to an extent--less so nowadays)...so you're forced to learn the basics that every serious programmer should know if he wants any hope to figure things out for himself when he strays off the beaten path.

 

Maybe it's not the *language* itself that's difficult to master...but the fact that you have to implement everything yourself and have to think about things like memory management, which you don't have to worry about in other languages.  This is why most of the other students dropped out...some had done a bit of VB and were expecting "programming" to be like that.

 

I understand now where you and I diverged on our respective definitions of "simple".



#12 Lord Method Man

Lord Method Man

    Banned

  • Tech Issues Solved: 1
  • Joined: 18-September 12

Posted 13 May 2014 - 21:07

The fact that it's a down-to-the-metal language (well, without going full-blown assembler).  You have to manage memory yourself, you have to get a good grip on pointers before you start avoiding dumb mistakes, there's no built-in routines or libraries for even simple things like sorting, you have to learn about makefiles and compiler/linker settings (to an extent--less so nowadays)...so you're forced to learn the basics that every serious programmer should know if he wants any hope to figure things out for himself when he strays off the beaten path.

 

 

That's my opinion as well. To me teaching someone programming by starting them out on a higher-level managed language is like teaching someone long division by handing them a calculator.



#13 _dandy_

_dandy_

    Neowinian Senior

  • Joined: 07-May 04

Posted 13 May 2014 - 21:22

That's my opinion as well. To me teaching someone programming by starting them out on a higher-level managed language is like teaching someone long division by handing them a calculator.

 

That's a brilliant analogy that summarizes my thoughts exactly.  Wish I would've come up with it.  You want to separate the wheat from the chaff--make 'em sweat a little, they'll thank you later.

 

That being said, again, I'm all in favor of letting hobbyists learn the higher-level languages and stick with them.  I just don't want them putting together a large-scale application that I'm gonna have to fix.  :-p



#14 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 10
  • Joined: 26-October 05

Posted 13 May 2014 - 21:31

The fact that it's a down-to-the-metal language (well, without going full-blown assembler).  You have to manage memory yourself, you have to get a good grip on pointers before you start avoiding dumb mistakes, there's no built-in routines or libraries for even simple things like sorting, you have to learn about makefiles and compiler/linker settings (to an extent--less so nowadays)...so you're forced to learn the basics that every serious programmer should know if he wants any hope to figure things out for himself when he strays off the beaten path.

 

Maybe it's not the *language* itself that's difficult to master...but the fact that you have to implement everything yourself and have to think about things like memory management, which you don't have to worry about in other languages.  This is why most of the other students dropped out...some had done a bit of VB and were expecting "programming" to be like that.

 

I understand now where you and I diverged on our respective definitions of "simple".

Thanks for clarifying. I would question whether dealing with headers, linker errors, makefiles and pointer arithmetic (note that most languages have the analogous concept of a "reference", just not pointer arithmetic) is what "programming" is really about, or whether it is just artifacts of a specific language that get in the way of learning basic, general programming concepts. I've never seen, for instance, an intro course using C that touched on parallel and asynchronous execution, although these are in every program today. The SICP, based on Scheme, does. Or how one might implement garbage collection. Or data streams. Or logic programming.

 

I think one can easily make a case that these are more fundamental and relevant concepts in today's world than C's particular difficulties. They're certainly not any easier, but less language-specific and generally applicable.



#15 Asmodai

Asmodai

    Neowinian

  • Joined: 13-March 02
  • Location: Fredericksburg, VA (USA)
  • OS: Windows 7 Professional
  • Phone: Motorola Droid Mini

Posted 13 May 2014 - 21:46

This is a matter of debate; some CS curriculums start with a high-level language such as Python, others with a low-level language like C. One can argue both ways. I fall firmly in the first camp, as most people today, I think. Therefore I would advise against learning C first and instead use a high-level language with out-of-the-box REPL support such as Python, Ruby or F#.

Personally in a CS curriculum I think it makes much more sense to start at the low level and build up then it does at a top level. If you start at the higher levels of abstraction then people tend to have no idea what is going on under the hood. From an educational point of view this isn't a good situation. When I learned derivatives they made us do it the hard way so we learned where it came from before they taught us the easy way. If your goal is just to "write a game" then sure start out as far along as you can... use an existing game and mod it, if you want more advanced use an existing engine (Unity, Unreal, Crysis, etc.), you probably shouldn't start from the bottom. If you really want to learn to program though and it isn't a means to an end you should start low and build up. Heck when I was in school we learned assembly first. We just wrote a few simple programs over a couple weeks before we moved on but they wanted you to get the basic concept of how registers and such work (it was just a part of the overall "Intro to Computer Science" course.) Have I touched assembly sense, no. But knowing how a processor works and understanding what a register is and what tedious tasks are abstracted from me are valuable. Same with C. You probably won't want to write programs in C on a daily basis but its simplicity and close to the metal nature teach valuable lessons that are important to understand. I would absolutely not recommend starting at a language that isn't even strongly typed. Again not that these things are bad and once you learn to program then maybe you will prefer to use a untyped/dynamically typed language but I feel having that understanding of what types are and how they interrelate is important for a programmer. It really depends though if you really want to learn to program, or you just want to do something else which requires you know some programming to accomplish.