Data Structures, C and C++
One especially important consideration is the choice of an algorithm description language. This choice actually depends on several factors, such as programmer background, programmer’s ability to express his views, language availability, etc. Pascal is still a very impressive language for an algorithm description language, but today the programming language ‘C’ and ‘C++’ has become pervasive as the most likely language in computer field.
A ‘C’ programmer knows that ‘C’ has its own capabilities, data types and operations. Additionally ‘C’ provides more useful programming constructs as tools to a ‘C’ programmer. ‘C’ has already two main data structures – array and structure. When we define structured data structures, such as stacks, queues, lists, etc., we will extensively make use of arrays and structures. In fact there are languages of significantly higher level than C that have many of these data types already built into them, but unfortunately many of them inefficient, and are therefore not in widespread use.
Once you know ‘C’, you can easily switch from ‘C’ to ‘C++’ without any tension because C++ is derived from C with new paradigm – Object-oriented programming, or OOP – well suited to modern programming needs.
Brief Discussion of C and C++
The programming language ‘C’ was designed and written by a system programmer Dennis Ritchie at AT&T Bell Labs of USA in 1972. Ritchie goal was to provide a language that would allow the programmer to access the hardware as is done with assembly language but with structured programming features similar to those found in high-level programming languages.
In fact the origin of ‘C’ language was just to make UNIX operating system potable in order to use it on a variety of computer types. At that time Ken Thompson, creator of UNIX operating system, and Dennis Ritchie needed a high-level language that combined low-level efficiency and hardware access with high-level generality and portability. So, building from older languages, he created ‘C’. After this UNIX operating system was rewritten in C language. More than 80% of UNIX is in C. UNIX became the first major operating system to be written in something other than assembly language. C rapidly became most programmer’s favorite language for writing program under MS-DOS. MS-DOS itself consists of C programs, as do most of its utility programs. You will be surprised to know that Windows 3.x graphical operating system was written in C. Even Windows 98 and Windows NT are written mostly in C.
C was originally defined in 1981 in the C Programming Language (Prentice Hall) by Brian Kernighan and Dennis Ritchie. This book described C the way Ritchie implemented it. This book became known simply as K&R C. Some programmers now refer to K&R C as “Classic C”. Over the years, compiler builders added features of C according to the requirements of their own users.
Many different organizations have their own C compilers which may differ from one another to a greater or lesser extent. In order to provide a standard for C, a technical committee on C language standardization, was formed by American National Standard Institute (ANSI) in 1983. ANSI was joined in their task by a committee of the International Standard Organization (ISO), which formed to define the language for the international programming community. And in 1990, the C language was finalized by the ANSI-committee and ISO. The language defined by them is known as Standard C.
‘C’ includes features to facilitate structured programming approach using a set of well-behaved constructs, such as the for-loop, while-loop, do-while loop, and the if-else statement. Additionally ‘C’ provides the facility of using top-down methodology (an idea of breaking a large program into smaller, more manageable tasks) by developing program units called functions to represent individual task modules.
No doubt the principles of structured programming improved the clarity, reliability and ease of maintenance of programs, but the major limitation of structured programming was that it gave first priority to algorithms, that is structured programming emphasize algorithms, rather than the data. Object-oriented programming was the next step. OOP gives the first priority to data, thus emphasizes data by using a class facility. OOP’s main features are – classes, inheritance and polymorphism. C++ is one the most frequently used OOPs language.
C++ programming language was designed and developed by Bjarne Stroustrup also at AT&T BELL laboratories in the early 1980’s. Bjarne Stroustrup based C++ on C language. Bjarne Stroustrup added some new features, such as objects, classes, polymorphism, inheritance, operator overloading, functions overloading etc, to the most popular language C without significantly changing its components. Bjarne Stroustrup called it “C with classes” originally. Later it was named as C++ (pronounced as C plus plus) where “++” is the C increment operator indicating an incremental development of C. C++ is a superset of C, meaning that any valid C programming is a C++ programming too.