What is C language
C is a general-purpose, procedural programming language. Dennis Ritchie first
devised C in the 1970s (at AT&T Bell Laboratories in Murray Hill, New Jersey) for
the purpose of implementing the Unix operating system and utilities with the
greatest possible degree of independence from specific hardware platforms. The
key characteristics of the C language are the qualities that made it suitable for that
purpose:
Source code portability
The ability to operate “close to the machine”
Efficiency
As a result, the developers of Unix were able to write most of the operating system
in C, leaving only a minimum of system-specific hardware manipulation to be
coded in assembly.
Because C was expressly designed for system programming, it is hardly surprising
that one of its major uses today is in programming embedded systems. At the
same time, however, many developers use C as a portable, structured high-level
language to write programs such as powerful word processor, database, and
graphics applications.
History of C
Here we are discussing brief history of c language. It was developed to supersede the drawback of previous languages such as B, BCPL etc.
Initially, C language was developed to be used in UNIX operating system. It inherits many features of previous languages such as B and BCPL.
Let's see the programming languages that were developed before C language.
Language | Year | Developed By |
Algol | 1960 | International Group |
BCPL | 1967 | Martin Richard |
B | 1970 | Ken Thompson |
Traditional C | 1972 | Dennis Ritchie |
K & R C | 1978 | Kernighan & Dennis Ritchie |
ANSI C | 1989 | ANSI Committee |
Features of C
C is the widely used language. It provides a rich setfeatures that are given below.
Simple
Machine Independent or Portable
Mid-level programming language
structured programming language
Rich Library
Memory Management
Fast Speed
Pointers
Recursion
Extensible
First C Program
Every C program must define at least one function of its own, with the special
name main( ): this is the first function invoked when the program starts. The
main( ) function is the program’s top level of control, and can call other functions
as subroutines.
Example for first C Program.
#include <stdio.h>
int main( )
{
printf("Hello World\n");
return 0;
}
Output:
Hello World
Program Description
#include <stdio.h>
It is the preprocessor command. It is the first statement of the program.
It starts with a hash (#) symbol.
The #include will tell the compiler to include the standard input/output library file (stdio.h).
int main()
main is first funtion of any c program and return value is int.
{ }
The curly brackets are used to put together block of statements called body of function.
printf(“ Hello World\n”);
The printf function is already defined in the stdio.h file.
It is used for printing the text on console.
'\n' is an escape character which represents a newline character.
return 0;
returns 0 indicates sucessfrul termination of function.