Overview Of C Programming

C is a powerful structured programming language. C combines the features of high-level programming language. C is suitable for both system and application programming. It is the most widely used general-purpose language in operating systems and embedded system development.

Overview Of C Programming

History Of C

The Root of the programming language is ALGOL. It was introduced in the early 1960s but it never became popular in the USA. ALGOL gave the concept of structured programming language. Martin Richards developed a language called BCPL in 1967. The full form of BCPL is Basic Combined Programming Language. Ken Thompson created B language using many features of ALGOL in 1970.

In 1972 C was created from BCPL, B, and ALGOL at the Bell Laboratories by Dennis Ritchie. C added the concept of data types and other powerful functionalities. Since it was developed along with the UNIX OS, it is strongly associated with UNIX. UNIX is the most popular network OS in use today.

C became more popular after the publication of the book ‘The C Programming Language’ by Brian Cunningham and Dennis Ritchie in 1978. American Standards Institute (ANSI) appointed a technical committee to define a standard for c in 1983. The committee approved a version of c known as ANSI C in 1989. It approved by ISO (International Standards Organization) in 1990. This version of C is also referred to as C89.

C++ is a language entirely based on C. It became an ANSI, ISO approved language in 1977. C++ added many features that make it an Object-Oriented language. The 1999 standard for C is referred to as C99.

Why C is important

  • A rich set of functions and operators can be used to write any complex program
  • Program written in C is fast and efficient
  • Faster than BASIC
  • C is highly portable
  • Well suited for structured Programming
  • Debugging, testing, maintenance easier
  • A coder can add its own function to the C library

Where we use C language

Nowadays a lot of programming language is in the market. But uses case is different for each of them. For example, we use Java and kotlin to develop android apps on the other hand we use swift to develop IOS apps. Another example, we use Python in machine learning. Use cases of each language are different. We can use c programming in
  • System application development
  • Network drivers
  • Database systems
  • Compilers and assemblers
  • Operating system development
  • Application software development

A Basic C Program


#include <stdio.h>
int main()
{
    printf("Hello world!\n");
    return 0;
}

This is a simple code which will show you ‘Hello World!’. The output of this program is ‘Hello World!’. From this code, we can understand the structure of C programming.

Program structure

The main() is a function. It tells the computer where the program starts. Every program has one main function. The compiler cannot understand the beginning of the program if we use more than one main function.

{‘or the opening brace marks the start of the program. ‘}’ or the closing brace marks the end of the program. So that opening and closing brace contain different statements.

printf is a predefined function for printing output. The print function causes everything between the starting and ending quotation marks to be printed out. Every statement in C should end with a semicolon. So, at the end of printf function, we use a semicolon. 

Basic Structure of C programs

We all know about the Lego blocks. We can build many kinds of house models with Legos. The c program is like a complete Lego house. Each of those blocks is functions. A c program contains multiple sections. Here a helpful picture for you to understand that.

Basic Structure of C programs


Documentation Section:

It contains details associated with the program given by the program. It is actually a part of the program. it contains information like the time of coding, description, author details. The main advantage of it is that other programmers can see those details and can take action according to that.

Link Section:

It used to declare all the header files that will be used in the program. A header file contains C function declarations and macro definitions to be shared between several source files. The link section link the header files to the system libraries.

Definition Section:

This section is used for defining different constants. We can set the value of  different constant in this section. For example, we want to set the value of g. To do that we have to use a keyword 'define'
#define g=9.80665

Global Declaration Section:

We declare the global variables in this section. This section is outside of all the functions. This section declares user-defined functions.

main () function section:

C program needs the main function. This section contains two parts which are the declaration part and the executable part. The declaration part declares all the variables. The executable part uses those variables. All the statements in those parts end with a semicolon.

Sub Program Section:

It contains all the user-defined functions which are called in the main function. A function is a block of code that performs a specific task.
Post a Comment (0)
Previous Post Next Post