Originally Posted by clayton1
Is C++ a good choice to learn to program for linux apps?
Or is python a better choice to learn to program for linux apps?
This depends on your application.
is easier to learn, and makes a great introductory language. It has a good sized community (which translates to lots of reusable code and libraries), and is nicely general purpose.
has found its place in the development of large applications, and has been designed to enable a number of different programming paradigms. Because of the way it evolved from C
, some of the syntax can sometimes be confusing. It is a very stable language. To learn it well takes quite a while, but of course you don't need to know the whole language in order to use it.
I should mention that many Linux applications are developed in C
rather than C++
; however, as a learner, it is good to be exposed to the object oriented paradigm early, even if you don't end up using it. There are a small set of applications where efficiency or direct hardware access is important. C
are good in these cases, being 'closer to the metal'.
The other important alternative to be aware of is the functional programming paradigm, in languages such as Haskell
. These are less commonly used, but they could have a bright future in world that is moving towards increased parallelism (ie, massive numbers of CPU/GPU cores).
Learning a second computer language is usually easier than the first one, so the first choice is not as important as who you learn from.
how do you know which standard header file to include in your
program which defines the keywords you use? eg. getchar() or setw() or clrscr().
One can of course simply grep
for them in the header files, but it is best to find a good source of reference documentation. For C++, this site
is useful, since you can look up any function to figure out its header file, and there is usually a complete and compilable example of the usage. Likewise for python documentation
. If you intend to do a serious amount of programming, there are reference books (eg Stroustrup's "The C++ Programming Language") that give good overviews of the language.