C is a general purpose programming language which was developed by Dennis Ritchie in 1973 at the bell laboratories. C programming language was developed for the UNIX operating system. The language was formalized by American National Standard Institute in 1988 and is approved by International Standard Organization. C is used to write both application and system programs.
Features of C:
C is an efficient programming language with highly structured and simplest syntax. C is a mid level programming language which include the features of both high level and low level languages. C is machine independent which means the program written at on computer can be executed on another without any errors. C programming language can differentiate between uppercase and lowercase letter and hence it is case sensitive language.
Hardware devices can be controlled by using codes written in C programming language. C language provides modular programming which means that the code can be divided into small modules by defining functions.
C standard Library:
The built in functions in C language are defined in C standard library for example the input and output functions are defined in “stdio” standard library. Therefore, to use an input function like scanf or printf, “stdio.h” header file should be included in the program. The data types, strings, files etc all are defined in the C standard library.
Basic syntax of C:
A basic C program consists of the following parts:
Main () function
Body of the program (C statements)
It is an instruction for the compiler to before the execution of the program. The preprocessor directives are used to modify the C source program before compilation.
Header files are used to include the definition of the various built in functions in the program. Basically header files are considered as the collection of standard library functions.
Main () function:
Main () is the part from where the execution of the program is started. Therefore, every C program must have a main function. Usually void is written before the name of the main () function as: void main (). Void means nothing and when it is written before any function it becomes the return data type of the function which means that the function does not return any value.
Body of the program:
Body of the program is actually the C statements which are used as instructions to perform a specific task. The statements within a function are written within curly braces and every statement should be ended with a semi colon.
The following is the basic syntax of a C program that includes preprocessor directive, header files, and a main () function and statements of C within the main function: