Question:
Is C a good first programming language?
Leinahtan99
2014-03-09 14:29:21 UTC
I am trying to learn to code, and I am interested in learning C. What are some of the pros and cons of C as a first language?
Four answers:
Andrew S
2014-03-09 14:42:04 UTC
It's a reasonable first choice. C has the advantage of being a fairly small language but not so small that you struggle to express yourself. It also forms the basis of many later languages that borrow heavily from its syntax so you'll find those languages a lot easier to learn with a thorough grounding in C.



On the other hand C coding tends to be a lot more work than other languages - you have to spend time coding what would be standard facilities in many other languages, and you are also responsible for low-level memory management in a way that other languages greatly simplify. A professional programmer would be expected to know that stuff in any event, though, so it comes down to your ultimate goals: if you want to learn programming to a professional standard and don't mind putting the work in C is a great choice. If you want to make some shiny toy straight away with the minimum of effort there are better languages out there - Java would be my suggestion because most of what you would want to do is rigidly standardised across platforms.
Greywolf
2014-03-10 07:30:26 UTC
I agree with the other two that say Python first, then C or C++.



Why? Learning to program is not just learning the language, it is also learning how to express your ideas as a program, learning how to describe data, learning what sort of approach to take, learning how to find the bug when your program does not work correctly. how to design bug detection into the program, how to document the program so that you understand it 6 months from now when you look at it again.



Python will enable you to get results (working programs) quickly while you are learning all that stuff.



C/C++ are excellent programming languages that produce highly efficient runtime code. Unfortunately they implement loads of advanced concepts that can produce very strange results in the hands of a beginner. You really have to know what you are doing to get beyond the "Hello World" stage.
darrenforster99
2014-03-09 14:46:35 UTC
C is a good language to learn - although maybe C++ would be better as it is more advanced.



C can be quite a tricky language to learn though if you've never come across any programming languages before.



BASIC is designed as a beginners language and then get into C and C++ as it can get quite complex some of the things you can do in C (especially if you start playing with some of the Assembly language options that C offers).



BASIC can run straight off with no compiling where as C needs compiling every time, so if you make a mistake and it doesn't work you need to go back edit the file and then re-compile to get it to work again and again and again. C can be really picky at times and most compilers don't show you the simple mistakes you've made where as a BASIC compiler is more likely to show you the mistakes.



For example if you tried to code something and missed off a ; at the end of a line BASIC wouldn't care 'cos it doesn't need ; to determine the end of the line, where as C would come up with some kind of error message, although the error message won't be that you missed a ; on a line, it'll be that it's kept compiling until it's hit a problem caused by that missing ; which could be a few lines down in the code. It's realising though that is what is causing the problem.



A typical c++ program is something like



#include



using namespace std ;



int main ()

{

cout << "Hello World" ;

return ( 1 ) ;

}



in many different BASIC's it's much more simpler although there are slight variations depending on which computer BASIC your using they're all very similar



10 PRINT "Hello World"



produces the same result as the C++ program above!



(in C++ there is cout in the Iostream header file (#include - which makes input and output easier cin >> and cout << where as in C++ you have to use printf and sprintf functions which can get a bit more complicated)



The good thing with learning C though is that it does allow you to easily adapt to some other languages - PHP is very similar to C and so is Java and Javascript.
?
2014-03-09 15:34:45 UTC
No. Learn Python, then C#. That was how I done it.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...