Advanced C
Have you ever wondered how
– powerful is it?
– efficient is it?
– it flexible is?
– deep can you explore your system?
if [ NO ]
Wait!! get some concepts right before you dive into it
else
You shouldn’t be here!!
Introduction – Where is it used?
- System Software Development
- Embedded Software Development
- OS Kernel Development
- Firmware, Middle-ware and Driver Development
- File System Development
- And many more!!
Introduction – What Language?
- A stylized communication technique
- Language has a collection of words called “Vocabulary” – Rich vocabulary helps us to be more expressive
- Language has finite rules called “Grammar”– Grammar helps us to form an infinite number of sentences
- The components of grammar :
– The syntax governs the structure of sentences
– The semantics governs the meanings of words and sentences - A stylized communication technique
- It has a set of words called “keywords”
- Finite rules (Grammar) to form sentences (often called expressions)
– Expressions govern the behavior of machines (often a computer) - Like natural languages, programming languages too have :
– Syntactic rules (to form expressions)
– Semantic rules (to govern the meaning of expressions)
Introduction – Brief History?
- Prior to C, most the computer languages (such as Algol) were academic oriented, unrealistic, and were generally defined by committees.
- Since such languages were designed to have an application domain in mind, they could not take the advantage of the underlying hardware and if done, were not portable or efficient under other systems.
- It was thought that a high-level language could never achieve the efficiency of assembly language.
- It was a revolutionary language and shook the computer world with its might. With just 32 keywords, C established itself in a very wide base of applications.
- It has a lineage starting from CPL, (Combined Programming Language) a never implemented language.
- Martin Richards implemented BCPL as a modified version of CPL. Ken Thompson further refined BCPL to a language named B.
- Later Dennis M. Ritchie added types to B and created a language, what we have as C, for rewriting the UNIX operating system.
Introduction – Standard
- “The C programming language” book served as a the primary reference for C programmers and implementers alike for nearly a decade.
- However, it didn’t define C perfectly, and there were many ambiguous parts in the language.
- As far as the library was concerned, only the C implementation in UNIX was close to the ’standard’.
- So many dialects existed for C and it was the time the language has to be standardized and it was done in 1989 with the ANSI C standard.
- Nearly after a decade another standard, C9X, for C is available that provides many significant improvements over the previous 1989 ANSI C standard.
Introduction – Important Characteristics
- Considered a middle-level language.
- Can be considered a pragmatic language.
- It is indented to be used by advanced programmers, for serious use, and not for novices and thus qualify less as an academic language for learning.
- Gives importance to compact code.
- It is widely available on various platforms from mainframes to palmtops and is known for its wide availability.
- It is a general-purpose language, even though it is applied and used effectively in various specific domains.
- It is a free-formatted language (and not a strongly-typed language)
- Efficiency and portability are the important considerations
- Library facilities play an important role.
Introduction – Keywords
- In programming, a keyword is a word that is reserved by a program because the word has a special meaning.
- Keywords can be commands or parameters.
- Every programming language has a set of keywords that cannot be used as variable names.
- Keywords are sometimes called reserved names.
Anatomy of a Simple C Code
108