[Android General] mhrsolanki2020:
Chapter 1 Theory On C prgramming

​

So basically What is C?

=> C is a programming language developed at AT & T's Bell Laboratories of USA in 1972. It was designed and written by only one person "Dennis Ritchie". In the late seventies C began to replace the other programming languages like PL/I,ALGOL,etc. No one pushed C neither was it 'official' Bell Labs language nor was it advertised by any means. Still C's reputation spread and its pool of users grew. Ritchie seems to have been rather surprised that so many programmers preferred C over the older languages, including FORTRAN. Still it is choosen over the newer languages like PASCAL and APL.

Probbaly , why C seems so popular is because it is reliable, simple and easy to use. Moreover, In an industry where newer languages, tools and technologies emerge and vanish day in and day out, a language that has survived for more than three decades has to be really good.

An opinion that is often heard today is -

"C has already superceded by languages like C++, C# and Java, so why bother to learn C today!!". I seriously beg to differ with this opinion. There are several reasons for this(according to the aurthor of the book "Let Us C"-Yashwant Kanetkar, and i agree with him):

I believer that nobody can learn C++ or Java directly. This is because while learning these languages you have things like Classes , Objects, Inheritance , polymorphism , Templates , etc. and also the elements like loop , if-else, nested if-else, switch,etc. These elements like loop etc should be learned in C , then about objects in C++ and then Exception handling in Java , so it is like a proper flow in the boat of Knowledge. Though this Three-Step learning process may take more time, but at the end of it you will definitely find it worth the trouble.

C++,C# or Java make use of principle called Object Oriented Programming(OOP) to organize the program. This organizing principle has lots of advantages to offer . But eve while using this organizing principle you would still need a good hold over the language elements of C and the basic programming Skill

Though many C++ and Java based tools and frameworks have evoleved over the years the importance of C is still unchanged because knowingly or unknowingly while using these frameworks and tools you would be still required to use the core C language elements -another good reason whu one should learn C before C++ , C# or Java.

Major parts of popular operating system like Windows, UNIX, Linux are still written in C (As we talked on it earlier) This is because even today when it comes to performance (speed of execution Nothing beats c) Moreover, if one is to extend the operating system to work with new devices one needs to write device driver programs. This programs are exclusively written in C (this is what you will do when you will build android kernels after learning C)

Mobile devices like Cellular phones and palmtops have become rage of today. Also, common consumer devices like mirowaveovens , washing machines and digital cameras are getting smarter by the day. This smartness comes from a microprocessor, an operating system and program embedded in this devices. These programs not only have to run fast but also have to work in limited amount of memory. No wonder that such programs are written in C. With these costraints on time and space, C is the language of choice while building such operating system and programs.

You must have seen several professional 3F computer games where the user navigates some object, like say a spaceship and fires bullets at the invaders. The essence of all such games is speed. Needless to say, such games wont become popular if they take a long time to move the spaceship or to fire a bullet . To match the expectations of the player the game has to react fast to the user inputs. This is where C language scores over the other languages. Many popular gaming frameworks have been built using C language

At times one is required to very closely interact with the hardware devices. Since C provides several languages elements that make this interaction feasible without compromising the performance, it is the preferred choice of the programmer.

I hope that these are very convincing reasons why you should adopt C as the first and the very important step in your quest for learning programming languages.

================================================================================

Getting Started with C
​

Communicating with a computer involces speaking the language the computer understands , which immediately rules out English as the language of communication with computer. However, there is a close analogy between learning English language and learning C language. The best method to learn English is to first learn the alphabets used in the language , then learn to combine these alphabets to form words, which , in turn, are combined to form sentences and sentences are combined to form paragraphs. Learning C is similar and easier . Instead of straight-away learning how to write programs , we must first know what alphabets, number and special symbols are used in C , then how using them,constants, variables and keywords are constructed and finally, how are these combined to form an instruction. It is illustrated below:

=========================================================================

C Character Set
​

A character denotes any alphabet, digit or special symbol used to represent information. The Valid aplphabets, numbers and special symbols allowed in C are :

We would talk about what are variables,constants and keywords and set up the programming environment and also make our first prorgram with its flowchart :)