C programming
Introduction
C is a general-purpose programming language developed at AT & T's Bell Telephone Laboratories (USA) in 1972 by Dennis Ritchie. Since it was originally designed for and implemented on the UNIX operating system, therefore, it is strongly associated with UNIX though nowadays it is running on almost all operating systems. Here are most common reasons why C is still so popular:
- C is one of the most popular programming languages of all time to create system software as well as application software.
- C is a standardized programming language with international standards.
- C is the base for almost all popular programming languages.
- C is one of the foundations for modern computer science and information technology.
- The language of choice for serious programming.
- Ease of understanding and learning, and one of the most commonly used programming languages in colleges and universities.
- Once students have learned C, then it will be easy for them to pick up any other languages.
Let's look at a simple application in C:
/*welcome.c (program name)*/
/*The following program displays the message "Welcome to C Programming"*
#include <stdio.h>
main()
{
printf("Welcome to C Programming");
}
Note
This program runs fine under GNU Gcc compiler. We have tested this in a Ubuntu Linux system. But if you are using any other compiler like Turbo C++, the program needs to be modified to be executed successfully. For the sake of simplicity, we have not included those additional stuff here.
Structure of the above C Program
Comments
Comments are a good way to better understanding of the program statements. In C programming language the comment entries start with a "/*" and terminate with "*/" at the end of the line. The compiler (a compiler is a computer program which translates source code written in a programming language into object code.) ignores the comment statements.
In the above program, the lines
/*welcome.c ( program name )*/
/*This program displays the message "Welcome to C Programming"*/
are comment lines.
#include directive
The #include directive instructs the compiler to include the contents of the file "stdio.h" (standard input-output header file) enclosed within angular brackets.
main() function
In C programming language the main() function serves a special purpose, it tells the compiler where the program start. Every C program must have one and only one main() function otherwise compiler can not understand the starting position of a program. The body of the main function surrounded by curly braces ( { } ). In the above program there is only one statement [ printf("Welcome to C Programming"); ] between the curly braces. Each statement in a C program terminated with a semicolon( ; ).
Output using printf
The only executable statement in above program is : printf ("Welcome to C Programming");
which displays the enclosed text i.e.
Welcome to C Programming
Next: C Tutorial
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/c-programming/programming-in-c.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics