C Language - Overview
C Language - Overview
C Language - Overview
C is a general−purpose, high−level language that was originally developed by Dennis
M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first
implemented on the DEC PDP-11 computer in 1972.
In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available
description of C, now known as the K&R standard.
The UNIX operating system, the C compiler, and essentially all UNIX application
programs have been written in C. C has now become a widely used professional
language for various reasons −
Easy to learn
Structured language
It produces efficient programs
It can handle low−level activities
It can be compiled on a variety of computer platforms
Facts about C
https://www.tutorialspoint.com/cprogramming/c_overview.htm 1/7
6/16/24, 10:55 AM C Language - Overview
because it produces code that runs nearly as fast as the code written in assembly
language.
Operating Systems
Language Compilers
Assemblers
Text Editors
Print Spoolers
Network Drivers
Modern Programs
Databases
Language Interpreters
Utilities
C covers all the basic concepts of programming. It's a base or mother programming
language to learn object−oriented programming like C++, Java, .Net, etc. Many
modern programming languages such as C++, Java, and Python have borrowed
syntax and concepts from C.
C programs are portable; hence they can run on different platforms without
significant modifications.
C has played a pivotal role as a fundamental programming language over the course
of programming history. However, its popularity for application development has
somewhat diminished in comparison to more contemporary languages. This may be
attributed to its low−level characteristics and the existence of higher−level
languages that offer a greater abundance of pre−existing abstractions and
capabilities. Nevertheless, the use of the programming language C remains
indispensable in domains where factors such as optimal performance, meticulous
management of system resources, and the imperative need for portability hold
utmost significance.
https://www.tutorialspoint.com/cprogramming/c_overview.htm 2/7
6/16/24, 10:55 AM C Language - Overview
Advantages of C Language
The following are the advantages of C language −
Drawbacks of C Language
The following are the disadvantages/drawbacks of C language −
https://www.tutorialspoint.com/cprogramming/c_overview.htm 3/7
6/16/24, 10:55 AM C Language - Overview
Applications of C Language
The following are the applications of C language −
https://www.tutorialspoint.com/cprogramming/c_overview.htm 4/7
6/16/24, 10:55 AM C Language - Overview
Include necessary header files that contain declarations of functions, constants, and
macros that can be used in one or more source code files. Some popular header files
are as −
stdio.h − Provides input and output functions like printf and scanf.
#include <stdio.h>
stdlib.h − Contains functions involving memory allocation, rand function, and other
utility functions.
#include <stdlib.h>
#include <math.h>
string.h − Includes functions for manipulating strings, such as strcpy, strlen, etc.
#include <string.h>
ctype.h − Functions for testing and mapping characters, like isalpha, isdigit, etc.
#include <ctype.h>
stdbool.h − Defines the boolean data type and values true and false.
#include <stdbool.h>
#include <time.h>
#include <limits.h>
https://www.tutorialspoint.com/cprogramming/c_overview.htm 5/7
6/16/24, 10:55 AM C Language - Overview
Define any macros or constants that will be used throughout the program. Macros
and constants are optional.
Example
#include <stdio.h>
#define PI 3.14159
int main() {
float radius = 5.0;
float area = PI * radius * radius;
Output
Global Declarations in C
int globalVariable;
void sampleFunction();
Declare global variables and functions that will be used across different parts of the
program. Take a look at the following example −
#include <stdio.h>
int main()
{
// Rest of the program
return 0;
}
https://www.tutorialspoint.com/cprogramming/c_overview.htm 6/7
6/16/24, 10:55 AM C Language - Overview
Main Function
Every C program must have a main function. It is the entry point of the program.
Take a look at the following example −
int main() {
float radius = 5.0;
float area = PI * radius * radius;
Functions in C
Define other functions as needed. The main function may call these functions. Take a
look at the following example:
#include <stdio.h>
int main() {
// Programming statements
return 0;
}
A C program can vary from 3 lines to millions of lines and it should be written into
one or more text files with extension ".c"; for example, hello.c. You can use "vi",
"vim" or any other text editor to write your C program into a file.
This tutorial assumes that you know how to edit a text file and how to write source
code inside a program file.
https://www.tutorialspoint.com/cprogramming/c_overview.htm 7/7