0% found this document useful (0 votes)
85 views3 pages

What Is C

(1) C is a programming language developed in 1972 by Dennis Ritchie at Bell Labs to replace older languages like FORTRAN and PL/I. (2) C became popular due to its reliability, simplicity, and ease of use, allowing it to survive for over 30 years. (3) While newer languages like C++ and Java have evolved, C remains important as the core elements of these languages are based on C, operating systems continue to be written in C for performance reasons, and many applications require C's low-level hardware interaction capabilities.

Uploaded by

Suchismita Dash
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views3 pages

What Is C

(1) C is a programming language developed in 1972 by Dennis Ritchie at Bell Labs to replace older languages like FORTRAN and PL/I. (2) C became popular due to its reliability, simplicity, and ease of use, allowing it to survive for over 30 years. (3) While newer languages like C++ and Java have evolved, C remains important as the core elements of these languages are based on C, operating systems continue to be written in C for performance reasons, and many applications require C's low-level hardware interaction capabilities.

Uploaded by

Suchismita Dash
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

: STARTING WITH C :

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 a man named Dennis Ritchie. In the late seventies C began to replace the more familiar
languages of that time like PL/I, ALGOL, etc. No one pushed C. It wasn’t made the ‘official’ Bell Labs
language. Thus, without any advertisement C’s reputation spread and its pool of users grew. Ritchie
seems to have been rather surprised that so many programmers preferred C to older languages like
FORTRAN or PL/I, or the newer ones like Pascal and APL. But, that's what happened.
Possibly 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 3 decades has to be really good.
An opinion that is often heard today is – “C has been 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:

(A) I believe that nobody can learn C++ or Java directly. This is because while learning these languages
you have things like classes, objects, inheritance, polymorphism, templates, exception handling,
references, etc. do deal with apart from knowing the actual language elements. Learning these
complicated concepts when you are not even comfortable with the basic language elements is like putting
the cart before the horse. Hence one should first learn all the language elements very thoroughly using C
language before migrating to C++, C# or Java. Though this two step learning process may take more
time, but at the end of it you will definitely find it worth the trouble.
(B)C++, C# or Java make use of a principle called Object Oriented Programming (OOP) to organize the
program. This organizing principle has lots of advantages to offer. But even while using this organizing
principle you would still need a good hold over the language elements of C and the basic programming
skills.
(C)Though many C++ and Java based programming tools and frameworks have evolved over the years
the importance of C is still unchallenged 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 why one
should learn C before C++, C# or Java.
(D)Major parts of popular operating systems like Windows, UNIX, Linux is still written in C. 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. These programs are exclusively written in C.
(E)Mobile devices like cellular phones and palmtops are becoming increasingly popular. Also, common
consumer devices like microwave oven, washing machines and digital cameras are getting smarter by the
day. This smartness comes from a microprocessor, an operating system and a 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 constraints on time and space, C is the language
of choice while building such operating systems and programs.
(F)You must have seen several professional 3D 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 won't become popular if they takes 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 other languages. Many popular gaming frameworks have been built using C
language.
(G)At times one is required to very closely interact with the hardware devices. Since C provides several
language elements that make this interaction feasible without compromising the performance it is the
preferred choice of the programmer.

Getting Started with C :


Communicating with a computer involves 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 classical method of
learning 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, numbers 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. A group of instructions would be combined later on to form a program. This is
illustrated in the Figure 1.1.

The C Character Set


A character denotes any alphabet, digit or special symbol used to represent information. Figure 1.2 shows
the valid alphabets, numbers and special symbols allowed in C.

Constants, Variables and Keywords:


The alphabets, numbers and special symbols when properly combined form constants, variables and
keywords. Let us see what are ‘constants’ and ‘variables’ in C. A constant is an entity that doesn’t change
whereas a variable is an entity that may change.
In any program we typically do lots of calculations. The results of these calculations are stored in
computers memory. Like human memory the computer memory also consists of millions of cells. The
calculated values are stored in these memory cells. To make the retrieval and usage of these values easy
these memory cells (also called memory locations) are given names. Since the value stored in each
location may change the names given to these locations are called variable names. Consider the
following example.
Here 3 is stored in a memory location and a namex is given to it.
Then we are assigning a new value 5 to the same memory location
x. This would overwrite the earlier value 3, since a memory
location can hold only one value at a time. This is shown in Figure
1.3
Types of C Constants
C constants can be divided into two major categories:
(a) Primary Constants
(b) Secondary Constants
These constants are further categorized as shown in Figure 1.4
At this stage we would restrict our discussion to only Primary Constants, namely, Integer, Real and
Character constants. Let us see the details of each of these constants. For constructing these different
types of constants certain rules have been laid down. These rules are as under:
Rules for Constructing Integer Constants :
(a) An integer constant must have at least one digit.
(b) It must not have a decimal point..
(c) It can be either positive or negative
(d) If no sign precedes an integer constant it is assumed to be
positive.
(e) No commas or blanks are allowed within an integer constant.
(f) The allowable range for integer constants is -32768 to 32767.

Truly speaking the range of an Integer constant depends upon the


compiler. For a 16-bit compiler like Turbo C or Turbo C++ the
range is –32768 to 32767. For a 32-bit compiler the range would be even greater. Question like what
exactly do you mean by a 16- bit or a 32-bit compiler, what range of an Integer constant has to do with
the type of compiler and such questions are discussed in detail in Chapter 16. Till that time it would be
assumed that we are working with a 16-bit compiler.
Ex.: 426 ,+782,-8000,-7605
Rules for Constructing Real Constants
Real constants are often called Floating Point constants. The real constants could be written in two forms
—Fractional form and Exponential form.
Following rules must be observed while constructing real
constants expressed in fractional form:
(a) A real constant must have at least one digit.
(b) It must have a decimal point.
(c) It could be either positive or negative.
(d) Default sign is positive.
(e) No commas or blanks are allowed within a real constant
Ex.: +325.34 ,426.0,-32.76,-48.5792
The exponential form of representation of real constants is usually used if the value of the constant is
either too small or too large. It however doesn’t restrict us in any way from using exponential form of
representation for other real constants.

You might also like