C Programming – Getting Started

Introduction to C Programming

The basic programming language commonly known as C language was discovered by Dennis Ritchie at Bell Laboratories in 1970. The language came in existence after 1978 when Brian Kernighan and Dennis Ritchie published the book describing the language “The C Programming”.

C Programming became the basic requirement to learn any language because of the study of C enables the programmer to do programming in other languages. It became the language of choice for software professionals.

Basic C Program:

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 printf("\n Hello Everyone");
 printf("\n Teche Programmer");
 printf("\n No need to worry with Teche");
 getch();
}
C Program Teche Programmer

Output:

Hello Everyone

Teche Programmer

No need to worry with Teche

.

.

C program Output teche Programmer

Explanation:

  • A program has divided into various parts and according to there work. A basic program has basically 3 parts:
  • Pre-Processor: A pre-processor is the most important part of any program because this contains the library functions or pre-installed functions which reduces the effort of the programmer to write the function of the program for performing various functions.
  • The Pre-Processor is having the syntax #include<stdio.h>. In this #include means including all the functions installed in the file named *******.h such as stdio.h contains scanf(), printf(), etc.
  • main() function: It is another essential part of any program in which the basic working of the program is defined according to the user and the whole program is controlled in the main() function definition. It is the entry point for the program from where the basic working and control of the program starts.
  • main() function are of 2 types:
    1. function with return value such as int main().
    2. function with no return value such as void main().
  • Logic and working: It is the last and the most complicated part of any program under which various operations are performed or define in the various parts of the program such as arrays, loops, functions. It also contains the input and output functions which enables it easier to understand.

Summary of the program:

As we have studied about the various parts of the program, now it’s time to understand the program:

Pre-Processors used in the program are stdio.h and conio.h. stdio.h enables us to perform input and output functions through scanf() and printf() that’s why its meaning is standard input-output.

conio.h is used to perform various functions through clrscr() and fetch(). According to these functions whenever they are called they can perform operations based on the user input. Such as getch() holds the console screen until the user doesn’t press any key from the keyboard.

We also use comments for defining the use of various functions and properties of the program. They are very useful for the programmers for an easy understanding of the blocks of the program and the purpose of various variables declared in the program. Comments are of two types:

  1. Single line comment: These comments are used to explain the function of statements in one line and they are followed by //-double slash.
  2. Multi-line comment: These were used to explain the function or statements in multiple lines and they are written between /*……*/ it means opens with a slash and a star and closes with a star and a slash.

One thought on “C Programming – Getting Started

Leave a Reply

Your email address will not be published. Required fields are marked *