Relations to other languages

Many later languages have borrowed directly or indirectly from C, including C++DGoRustJavaJavaScriptLimboLPCC#Objective-CPerlPHPPythonVerilog(hardware description language),[4] and Unix's C shell. These languages have drawn many of their control structures and other basic features from C. Most of them (with Python being the most dramatic exception) are also very syntactically similar to C in general, and they tend to combine the recognizable expression and statement syntax of C with underlying type systems, data models, and semantics that can be radically different.

Overview

Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope and recursion, while a static type systemprevents many unintended operations. In C, all executable code is contained within subroutines, which are called "functions" (although not in the strict sense of functional programming). Function parameters are always passed by value. Pass-by-reference is simulated in C by explicitly passing pointer values. C program source text is free-format, using the semicolon as a statement terminator and curly braces for grouping blocks of statements.
The C language also exhibits the following characteristics:
  • There is a small, fixed number of keywords, including a full set of flow of control primitives: forif/elsewhileswitch, and do/while. There is one namespace, and user-defined names are not distinguished from keywords by any kind of sigil.
  • There are a large number of arithmetical and logical operators, such as ++=++&~, etc.
  • More than one assignment may be performed in a single statement.
  • Function return values can be ignored when not needed.
  • Typing is static, but weakly enforced: all data has a type, but implicit conversions can be performed; for instance, characters can be used as integers.
  • Declaration syntax mimics usage context. C has no "define" keyword; instead, a statement beginning with the name of a type is taken as a declaration. There is no "function" keyword; instead, a function is indicated by the parentheses of an argument list.
  • User-defined (typedef) and compound types are possible.
    • Heterogeneous aggregate data types (struct) allow related data elements to be accessed and assigned as a unit.
    • Array indexing is a secondary notation, defined in terms of pointer arithmetic. Unlike structs, arrays are not first-class objects; they cannot be assigned or compared using single built-in operators. There is no "array" keyword, in use or definition; instead, square brackets indicate arrays syntactically, e.g. month[11].
    • Enumerated types are possible with the enum keyword. They are not tagged, and are freely interconvertible with integers.
    • Strings are not a separate data type, but are conventionally implemented as null-terminated arrays of characters.
  • Low-level access to computer memory is possible by converting machine addresses to typed pointers.
  • Procedures (subroutines not returning values) are a special case of function, with an untyped return type void.
  • Functions may not be defined within the lexical scope of other functions.
  • Function and data pointers permit ad hoc run-time polymorphism.
  • preprocessor performs macro definition, source code file inclusion, and conditional compilation.
  • There is a basic form of modularity: files can be compiled separately and linked together, with control over which functions and data objects are visible to other files viastatic and extern attributes.
  • Complex functionality such as I/Ostring manipulation, and mathematical functions are consistently delegated to library routines.
C does not include some features found in newer, more modern high-level languages, including object orientation and garbage collection

Design

C is an imperative (procedural) language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language, such as in system programming.
Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers.

C language tutorial reference E-books & research papers

  • [ANSI 89] American National Standards Institute., American National Standard for Information  Programming Language C, X3 159-1989
  • [Kernighan 78] B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall: Englewood Cliffs, NJ, 1978. Second edition, 1988.
  • [Thinking 90] C* Programming Guide, Thinking Machines Corp.: Cambridge Mass., 1990.

Key points to remember in C language

  1. The C language is structured, middle level programming language developed by Dennis Ritchie
  2. Operating system programs such as Windows, Unix, Linux are written in C language
  3. C89/C90 and C99 are two standardized editions of C language
  4. C has been written in assembly language

Which level is C language belonging to?


S.no
High Level
Middle Level
Low Level
1High level languages provide almost everything that the programmer might need to do as already built into the languageMiddle level languages don’t provide all the built-in functions found in high level languages, but provides all building blocks that we need to produce the result we wantLow level languages provides nothing other than access to the machines basic instruction set
2Examples:
Java, Python
C, C++Assembler

Uses of C programming language

The C programming language is used for developing system applications that forms a major portion of operating systems such as Windows, UNIX and Linux. Below are some examples of C being used.
  • Database systems
  • Graphics packages
  • Word processors
  • Spreadsheets
  • Operating system development
  • Compilers and Assemblers
  • Network drivers
  • Interpreters