What is C language.
what is C language in simple words 

C language is count in most popular languages. In this tutorial we learn basic requirements and structure of C programing language. After learning this article you will be able to describe the programs of C programing language.


Introduced to "C" language.

In order to correctly perform any task, we need to have proper tools. For example for gardening we need gardening tools and for painting we need a collection of paints, brushes and canvas. Similarly we need proper tools for programming.
 A collection of all the necessary tools for programming makes up a programming environment. It is essential to setup a programming environment before we start writing programs. It works as a basic platform for us to write and execute programs.

What is Integrated Development Environment (IDE)

A software that provides a programming environment to facilitate programmers in writing and executing computer programs is known as an Integrated Development Environment (IDE).
An IDE has a graphical user interface (GUI), meaning that a user can interact with it using windows and buttons to provide input and get output. An IDE consists of tools that help a programmer throughout the phases of writing, executing and testing a computer program.
 This is achieved by combining text editors, compilers and debuggers in a single interface. Some of the many available IDEs for C programming language are:

Software for writing C programs.

  1)  Visual Studio
 
  2)  Xcode
 
 3)   Code::Blocks

 4)   Dev C++

Essentials for writing programs

 1- Text editor

   2- Compiler

What is text editor

An text editor is a software that allows programmers to write and edit computer programs. All IDEs have their own specific text editors. It is the main screen of an IDE where we can write our programs.
Image a basic C language program written in the text editor of IDE Code::Blocks. When executed, this program displays Hello World! on computer screen. We have to save our file before it can be executed. We have named our program file as "HelloWorld.c". We can click on the build and run button to see the program's output,

Role of Compiler

Computers only understand and work in machine language consisting of Os and 1s. They require the conversion of a program written in programming language to machine language, in order to execute it. This is achieved using a compiler. A compiler is a software that is responsible for conversion of a computer program written in some high level programming language to machine language code

Syntax of C programs and Syntax errors.


Syntax of C programs

Each programming language has some primitive building blocks and provides some rules in order to write an accurate program. This set of rules is known as syntax of the language.

Syntax errors.

Syntax can be thought of as grammar of a programming language. While programming, if proper syntax or rules of the programming language are not followed, the program does not get compiled. In this case, the compiler generates an error. This kind of errors are called syntax errors.

Reserved Words.

Every programming language has a list of words that are predefined. Each word has its specific meaning already known to the compiler. These words are known

as reserved words or keywords. If a programmer gives them a definition of his own, it causes a syntax error. In the following we describe the list of reserved words in C programming language.

What is C language.
How many reserved words are there in C?

There is 32 reserved words in C programming language.

Structure of a C program:


1- Link section or header section

While writing programs in C language, we make extensive use of functions that are already defined in the language. But before using the existing functions, we need to include the files where these functions have been defined. These files are called header files. We include these header files in our program by writing the include statements at the top of program. 
General structure of an include statement is as follows:
     "#include<header_file_name>"

Here header_file_name can be the name of any header file.

In the above example we have include file stdio.h that contains information related to input and output functions. Many other header files are also available, for example file math.h contains all predefined mathematics functions.

2- Main section:

It consists of a main() function. Every C program must contain a main() function and it is the starting point of execution.

3-. Body of main () function :

The body of main() is enclosed in the curly braces { }. All the statements inside these curly braces make the body of main function. In the above program the statement printf("Hello world!"); uses a predefined function printf to display the statement Hello World! on computer screen. We can also create other functions in our program and use them inside the body of main() function.

IMPORTANT NOTE :

Following points must be kept in mind in order to write syntactically correct C language programs.

  1.   The sequence of statements in a C language program should be according to the sequence in which we want our program to be executed.

   2-   C language is case sensitive. It means that if a keyword is defined with all small case letters, we cannot capitalize any letter i.e. int is different from Int. Former is a keyword, whereas latter is not.


      3-   Each statement ends with a semi-colon; symbol.

Purpose and Syntax of comments in C programs

Comments are the statements in a program that are ignored by the compiler and do not get executed. Usually comments are written in natural language e.g. in English language, in order to provide description of our code.

Purpose of writing comments.

Comments can be thought of as documentation of the program. Their purpose is twofold.

  •  They facilitate other programmers to understand our code.
  •  They help us to understand our own code even after years of writing it. We do not want these statements to be executed, because it. may cause syntax error as the statements are written in natural language

 Syntax of writing comments:

In C programming language, there are two types of comments.

  •  Single-line Comments
  • Multi-line Comments

Types of comments

There is two types of writing comments in C language

  1.   Single-line comments 
      start with //. Anything after // on the same line, is Considered a comment. For example, //This is a comment.

   2.   Multiple line comments

Multiple line comments start with /* and end at */. Anything between /* and.*/ is . considered a comment, even on multiple lines.
 For example,
/*this is a multi-Line comment*/

So your's today tutorial  goes on end meet in the next tutorial.

  •  Please follow us